Class: Socrates::SampleStates::StateFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/socrates/sample_states.rb

Instance Method Summary collapse

Instance Method Details

#build(state_data:, adapter:, session:) ⇒ Object



17
18
19
20
21
22
# File 'lib/socrates/sample_states.rb', line 17

def build(state_data:, adapter:, session:)
  classname = StringHelpers.underscore_to_classname(state_data.state_id)

  Object.const_get("Socrates::SampleStates::#{classname}")
    .new(data: state_data, adapter: adapter, session: session)
end

#defaultObject



9
10
11
# File 'lib/socrates/sample_states.rb', line 9

def default
  :get_started
end

#expiredObject



13
14
15
# File 'lib/socrates/sample_states.rb', line 13

def expired(*)
  :expired
end