Class: TextToNoise::IterationMappingCondition

Inherits:
Object
  • Object
show all
Defined in:
lib/text_to_noise/iteration_mapping_condition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#countObject

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

Returns:

  • (Boolean)


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