Class: ProconBypassMan::Procon::Macro
- Inherits:
-
Object
- Object
- ProconBypassMan::Procon::Macro
- Defined in:
- lib/procon_bypass_man/procon/macro.rb
Defined Under Namespace
Classes: BaseNestedStep, NestedStep, OnetimeNestedStep
Instance Attribute Summary collapse
-
#after_callback_block ⇒ Object
Returns the value of attribute after_callback_block.
-
#force_neutral_buttons ⇒ Object
Returns the value of attribute force_neutral_buttons.
-
#name ⇒ Object
Returns the value of attribute name.
-
#steps ⇒ Object
Returns the value of attribute steps.
Instance Method Summary collapse
- #finished? ⇒ Boolean
-
#initialize(name:, steps:, force_neutral_buttons: [], &after_callback_block) ⇒ Macro
constructor
A new instance of Macro.
- #next_step ⇒ Object
- #ongoing? ⇒ Boolean
Constructor Details
#initialize(name:, steps:, force_neutral_buttons: [], &after_callback_block) ⇒ Macro
Returns a new instance of Macro.
81 82 83 84 85 86 |
# File 'lib/procon_bypass_man/procon/macro.rb', line 81 def initialize(name: , steps: , force_neutral_buttons: [], &after_callback_block) self.name = name self.steps = steps self.after_callback_block = after_callback_block self. = # 外部から呼ばれるだけ end |
Instance Attribute Details
#after_callback_block ⇒ Object
Returns the value of attribute after_callback_block.
79 80 81 |
# File 'lib/procon_bypass_man/procon/macro.rb', line 79 def after_callback_block @after_callback_block end |
#force_neutral_buttons ⇒ Object
Returns the value of attribute force_neutral_buttons.
79 80 81 |
# File 'lib/procon_bypass_man/procon/macro.rb', line 79 def @force_neutral_buttons end |
#name ⇒ Object
Returns the value of attribute name.
79 80 81 |
# File 'lib/procon_bypass_man/procon/macro.rb', line 79 def name @name end |
#steps ⇒ Object
Returns the value of attribute steps.
79 80 81 |
# File 'lib/procon_bypass_man/procon/macro.rb', line 79 def steps @steps end |
Instance Method Details
#finished? ⇒ Boolean
112 113 114 |
# File 'lib/procon_bypass_man/procon/macro.rb', line 112 def finished? steps.empty? end |
#next_step ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/procon_bypass_man/procon/macro.rb', line 88 def next_step step = steps.first if step.is_a?(Symbol) return steps.shift end if step.is_a?(Hash) nested_step = if step[:continue_for] NestedStep.new(step) else OnetimeNestedStep.new(step) end if nested_step.over? steps.shift # NestedStepを破棄する self.after_callback_block.call if self.after_callback_block && steps.empty? return next_step else return nested_step.next_step end end end |
#ongoing? ⇒ Boolean
116 117 118 |
# File 'lib/procon_bypass_man/procon/macro.rb', line 116 def ongoing? !finished? end |