lib/rubyonacid/factories/constant.rb in rubyonacid-0.2.0 vs lib/rubyonacid/factories/constant.rb in rubyonacid-0.3.0
- old
+ new
@@ -1,11 +1,13 @@
require 'rubyonacid/factory'
module RubyOnAcid
+#A factory that returns a preset value for all keys.
class ConstantFactory < Factory
+ #A value between 0 and 1 that get_unit will return.
attr_accessor :value
def value=(value)
raise "assigned #{value} to value, must be between -1 and 1" if value < -1 or value > 1
@value = value
end
@@ -13,10 +15,10 @@
def initialize(value = 0.5)
super
@value = value
end
- #Increment counter for key, looping it around to opposite side if it exits boundary.
+ #Returns assigned value.
def get_unit(key)
@value
end
end
\ No newline at end of file