Class: Distribot::Phase
- Inherits:
-
Object
- Object
- Distribot::Phase
- Defined in:
- lib/distribot/phase.rb
Instance Attribute Summary collapse
-
#handlers ⇒ Object
Returns the value of attribute handlers.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_final ⇒ Object
Returns the value of attribute is_final.
-
#is_initial ⇒ Object
Returns the value of attribute is_initial.
-
#name ⇒ Object
Returns the value of attribute name.
-
#on_error_transition_to ⇒ Object
Returns the value of attribute on_error_transition_to.
-
#transitions_to ⇒ Object
Returns the value of attribute transitions_to.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Phase
constructor
A new instance of Phase.
- #to_hash ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Phase
Returns a new instance of Phase.
12 13 14 15 16 17 18 19 20 |
# File 'lib/distribot/phase.rb', line 12 def initialize(attrs = {}) attrs.each do |key, val| next if key.to_s == 'handlers' public_send("#{key}=", val) end self.name = name self.handlers = [] initialize_handlers(attrs[:handlers] || []) end |
Instance Attribute Details
#handlers ⇒ Object
Returns the value of attribute handlers.
4 5 6 |
# File 'lib/distribot/phase.rb', line 4 def handlers @handlers end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/distribot/phase.rb', line 4 def id @id end |
#is_final ⇒ Object
Returns the value of attribute is_final.
4 5 6 |
# File 'lib/distribot/phase.rb', line 4 def is_final @is_final end |
#is_initial ⇒ Object
Returns the value of attribute is_initial.
4 5 6 |
# File 'lib/distribot/phase.rb', line 4 def is_initial @is_initial end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/distribot/phase.rb', line 4 def name @name end |
#on_error_transition_to ⇒ Object
Returns the value of attribute on_error_transition_to.
4 5 6 |
# File 'lib/distribot/phase.rb', line 4 def on_error_transition_to @on_error_transition_to end |
#transitions_to ⇒ Object
Returns the value of attribute transitions_to.
4 5 6 |
# File 'lib/distribot/phase.rb', line 4 def transitions_to @transitions_to end |
Instance Method Details
#to_hash ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/distribot/phase.rb', line 22 def to_hash { id: id, name: name, is_initial: is_initial || false, is_final: is_final || false, transitions_to: transitions_to, on_error_transition_to: on_error_transition_to, handlers: handlers } end |