Class: Simplerubysteps::Branch
- Inherits:
-
Object
- Object
- Simplerubysteps::Branch
- Defined in:
- lib/simplerubysteps/model.rb
Overview
FIXME refactor statemachine code dupduplicate
Instance Attribute Summary collapse
-
#start_at ⇒ Object
readonly
Returns the value of attribute start_at.
-
#states ⇒ Object
readonly
Returns the value of attribute states.
Instance Method Summary collapse
- #add(state) ⇒ Object
-
#initialize ⇒ Branch
constructor
A new instance of Branch.
- #render ⇒ Object
Constructor Details
#initialize ⇒ Branch
Returns a new instance of Branch.
162 163 164 |
# File 'lib/simplerubysteps/model.rb', line 162 def initialize() @states = {} end |
Instance Attribute Details
#start_at ⇒ Object (readonly)
Returns the value of attribute start_at.
160 161 162 |
# File 'lib/simplerubysteps/model.rb', line 160 def start_at @start_at end |
#states ⇒ Object (readonly)
Returns the value of attribute states.
159 160 161 |
# File 'lib/simplerubysteps/model.rb', line 159 def states @states end |
Instance Method Details
#add(state) ⇒ Object
166 167 168 169 170 171 172 173 |
# File 'lib/simplerubysteps/model.rb', line 166 def add(state) @start_at = state.name unless @start_at @states[state.name] = state state.state_machine = self state end |
#render ⇒ Object
175 176 177 178 179 180 |
# File 'lib/simplerubysteps/model.rb', line 175 def render { :StartAt => @start_at, :States => @states.map { |name, state| [name, state.render] }.to_h, } end |