Class: RubyOnAcid::ConstantFactory
- Defined in:
- lib/rubyonacid/factories/constant.rb
Overview
A factory that returns a preset value for all keys.
Instance Attribute Summary collapse
-
#value ⇒ Object
A value between 0 and 1 that get_unit will return.
Instance Method Summary collapse
-
#get_unit(key) ⇒ Object
Returns assigned value.
-
#initialize(value = 0.5) ⇒ ConstantFactory
constructor
A new instance of ConstantFactory.
Methods inherited from Factory
#boolean, #choose, #get, #within
Constructor Details
#initialize(value = 0.5) ⇒ ConstantFactory
Returns a new instance of ConstantFactory.
15 16 17 18 |
# File 'lib/rubyonacid/factories/constant.rb', line 15 def initialize(value = 0.5) super @value = value end |
Instance Attribute Details
#value ⇒ Object
A value between 0 and 1 that get_unit will return.
9 10 11 |
# File 'lib/rubyonacid/factories/constant.rb', line 9 def value @value end |
Instance Method Details
#get_unit(key) ⇒ Object
Returns assigned value.
21 22 23 |
# File 'lib/rubyonacid/factories/constant.rb', line 21 def get_unit(key) @value end |