Class: TextToNoise::IterationMappingCondition
- Inherits:
-
Object
- Object
- TextToNoise::IterationMappingCondition
- Defined in:
- lib/text_to_noise/iteration_mapping_condition.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
Instance Method Summary collapse
-
#initialize(count) ⇒ IterationMappingCondition
constructor
A new instance of IterationMappingCondition.
- #play?(match_data = nil) ⇒ Boolean (also: #call)
Constructor Details
#initialize(count) ⇒ IterationMappingCondition
Returns a new instance of IterationMappingCondition.
5 6 7 8 |
# File 'lib/text_to_noise/iteration_mapping_condition.rb', line 5 def initialize( count ) self.count = count @iteration = 0 end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
3 4 5 |
# File 'lib/text_to_noise/iteration_mapping_condition.rb', line 3 def count @count end |
Instance Method Details
#play?(match_data = nil) ⇒ Boolean Also known as: call
10 11 12 13 |
# File 'lib/text_to_noise/iteration_mapping_condition.rb', line 10 def play?( match_data=nil ) @iteration += 1 count == 1 || (@iteration % count == 0) end |