Class: Gloo::Objs::EachLine
- Inherits:
-
Object
- Object
- Gloo::Objs::EachLine
- Defined in:
- lib/gloo/objs/ctrl/each_line.rb
Constant Summary collapse
- LINE =
'line'.freeze
Class Method Summary collapse
-
.use_for?(iterator_obj) ⇒ Boolean
Use this iterator for each loop?.
Instance Method Summary collapse
-
#initialize(engine, iterator_obj) ⇒ EachLine
constructor
——————————————————————— Create Iterator ———————————————————————.
-
#run ⇒ Object
Run for each line.
-
#set_line(line) ⇒ Object
Set the value of the word.
Constructor Details
#initialize(engine, iterator_obj) ⇒ EachLine
Create Iterator
18 19 20 21 |
# File 'lib/gloo/objs/ctrl/each_line.rb', line 18 def initialize( engine, iterator_obj ) @engine = engine @iterator_obj = iterator_obj end |
Class Method Details
Instance Method Details
#run ⇒ Object
Run for each line.
45 46 47 48 49 50 51 52 53 |
# File 'lib/gloo/objs/ctrl/each_line.rb', line 45 def run str = @iterator_obj.in_value return unless str str.each_line do |line| set_line line @iterator_obj.run_do end end |
#set_line(line) ⇒ Object
Set the value of the word.
58 59 60 61 62 63 |
# File 'lib/gloo/objs/ctrl/each_line.rb', line 58 def set_line( line ) o = @iterator_obj.find_child LINE return unless o o.set_value line end |