Class: WithEase::Iterator
- Inherits:
-
Object
- Object
- WithEase::Iterator
- Includes:
- Enumerable
- Defined in:
- lib/with_ease/iterator.rb
Instance Attribute Summary collapse
-
#advancer ⇒ Object
readonly
Returns the value of attribute advancer.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#advancer ⇒ Object (readonly)
Returns the value of attribute advancer.
7 8 9 |
# File 'lib/with_ease/iterator.rb', line 7 def advancer @advancer end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/with_ease/iterator.rb', line 7 def value @value end |
Instance Method Details
#advance ⇒ Object
9 |
# File 'lib/with_ease/iterator.rb', line 9 def advance = drop(1) |
#drop(n = 1) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/with_ease/iterator.rb', line 11 def drop(n=1) n.times do @value = @advancer.(value) end self end |
#drop_fn ⇒ Object
17 |
# File 'lib/with_ease/iterator.rb', line 17 def drop_fn = -> (n=1) { drop n } |
#each ⇒ Object
20 21 22 23 24 25 |
# File 'lib/with_ease/iterator.rb', line 20 def each loop do yield value drop end end |
#take_fn ⇒ Object
26 |
# File 'lib/with_ease/iterator.rb', line 26 def take_fn = -> (n) { take n } |