Class: Decorators::Repeat
- Inherits:
-
Decorator
- Object
- Decorator
- Decorators::Repeat
- Defined in:
- lib/behave_fun/decorators/repeat.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#counter ⇒ Object
Returns the value of attribute counter.
Instance Method Summary collapse
- #child_fail ⇒ Object
- #child_success ⇒ Object
- #params=(params) ⇒ Object
- #serializable_status_fields ⇒ Object
- #start ⇒ Object
Instance Attribute Details
#counter ⇒ Object
Returns the value of attribute counter.
3 4 5 |
# File 'lib/behave_fun/decorators/repeat.rb', line 3 def counter @counter end |
Instance Method Details
#child_fail ⇒ Object
22 23 24 |
# File 'lib/behave_fun/decorators/repeat.rb', line 22 def child_fail child_success end |
#child_success ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/behave_fun/decorators/repeat.rb', line 10 def child_success return @children[0].reset unless params[:times] @counter += 1 if @counter < params[:times] @children[0].reset execute else success end end |
#params=(params) ⇒ Object
30 31 32 |
# File 'lib/behave_fun/decorators/repeat.rb', line 30 def params=(params) @params = ParamsSchema[params] end |
#serializable_status_fields ⇒ Object
26 27 28 |
# File 'lib/behave_fun/decorators/repeat.rb', line 26 def serializable_status_fields [:counter] end |
#start ⇒ Object
5 6 7 8 |
# File 'lib/behave_fun/decorators/repeat.rb', line 5 def start super @counter = 0 end |