Class: Filter
Overview
フィルタ
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(it, &block) ⇒ Filter
constructor
A new instance of Filter.
- #next ⇒ Object
- #next? ⇒ Boolean
Methods inherited from Iterator
Constructor Details
#initialize(it, &block) ⇒ Filter
Returns a new instance of Filter.
33 34 35 36 37 38 |
# File 'lib/jiji/util/iterator.rb', line 33 def initialize( it, &block ) super() @it = it @test = block inner_next end |
Instance Method Details
#close ⇒ Object
50 51 52 |
# File 'lib/jiji/util/iterator.rb', line 50 def close @it.close if @it end |
#next ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/jiji/util/iterator.rb', line 42 def next raise "illegal state." unless next? begin return @next_element ensure inner_next end end |
#next? ⇒ Boolean
39 40 41 |
# File 'lib/jiji/util/iterator.rb', line 39 def next? @has_next end |