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
#drop(n = 1) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/with_ease/iterator.rb', line 9 def drop(n=1) n.times do @value = @advancer.(value) end self end |
#drop_fn ⇒ Object
15 |
# File 'lib/with_ease/iterator.rb', line 15 def drop_fn = -> (n=1) { drop n } |
#each ⇒ Object
18 19 20 21 22 23 |
# File 'lib/with_ease/iterator.rb', line 18 def each loop do yield value drop end end |
#take_fn ⇒ Object
24 |
# File 'lib/with_ease/iterator.rb', line 24 def take_fn = -> (n) { take n } |