Class: SampleModels::AttributeSequence::LengthSource
- Inherits:
-
AbstractSource
- Object
- AbstractSource
- SampleModels::AttributeSequence::LengthSource
- Defined in:
- lib/sample_models/attribute_sequence.rb
Instance Method Summary collapse
-
#initialize(validation) ⇒ LengthSource
constructor
A new instance of LengthSource.
- #value ⇒ Object
Methods inherited from AbstractSource
Constructor Details
#initialize(validation) ⇒ LengthSource
Returns a new instance of LengthSource.
72 73 74 75 |
# File 'lib/sample_models/attribute_sequence.rb', line 72 def initialize(validation) super() @validation = validation end |
Instance Method Details
#value ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/sample_models/attribute_sequence.rb', line 77 def value minimum = @validation.config[:minimum] minimum ||= ( @validation.config[:within] && @validation.config[:within].begin ) minimum ||= ( @validation.config[:in] && @validation.config[:in].begin ) minimum ||= 1 value = 'a' * minimum @number.times do value = value.succ end value end |