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