Class: RMachine::Rule
- Inherits:
-
Object
- Object
- RMachine::Rule
- Defined in:
- lib/r_machine/rule.rb
Instance Attribute Summary collapse
-
#rule_options ⇒ Object
readonly
Returns the value of attribute rule_options.
Instance Method Summary collapse
- #change_to ⇒ Object
- #conditional_method ⇒ Object
- #has_conditional? ⇒ Boolean
-
#initialize(params = {}) ⇒ Rule
constructor
A new instance of Rule.
- #must_have_specific_state? ⇒ Boolean
- #state_should_be ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Rule
Returns a new instance of Rule.
5 6 7 |
# File 'lib/r_machine/rule.rb', line 5 def initialize(params={}) @rule_options = params end |
Instance Attribute Details
#rule_options ⇒ Object (readonly)
Returns the value of attribute rule_options.
3 4 5 |
# File 'lib/r_machine/rule.rb', line 3 def @rule_options end |
Instance Method Details
#change_to ⇒ Object
21 22 23 |
# File 'lib/r_machine/rule.rb', line 21 def change_to @rule_options[:new_state] end |
#conditional_method ⇒ Object
17 18 19 |
# File 'lib/r_machine/rule.rb', line 17 def conditional_method @rule_options[:if] end |
#has_conditional? ⇒ Boolean
9 10 11 |
# File 'lib/r_machine/rule.rb', line 9 def has_conditional? !@rule_options[:if].nil? end |
#must_have_specific_state? ⇒ Boolean
13 14 15 |
# File 'lib/r_machine/rule.rb', line 13 def must_have_specific_state? !@rule_options[:from].nil? end |
#state_should_be ⇒ Object
25 26 27 |
# File 'lib/r_machine/rule.rb', line 25 def state_should_be @rule_options[:from] end |