Class: Distribot::Phase

Inherits:
Object
  • Object
show all
Defined in:
lib/distribot/phase.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#handlersObject

Returns the value of attribute handlers.



4
5
6
# File 'lib/distribot/phase.rb', line 4

def handlers
  @handlers
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/distribot/phase.rb', line 4

def id
  @id
end

#is_finalObject

Returns the value of attribute is_final.



4
5
6
# File 'lib/distribot/phase.rb', line 4

def is_final
  @is_final
end

#is_initialObject

Returns the value of attribute is_initial.



4
5
6
# File 'lib/distribot/phase.rb', line 4

def is_initial
  @is_initial
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/distribot/phase.rb', line 4

def name
  @name
end

#on_error_transition_toObject

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_toObject

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_hashObject



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