Module: Wamp::Manager::Event::ClassMethods
- Included in:
- Wamp::Manager::Event
- Defined in:
- lib/wamp/manager/event.rb
Overview
methods responsbile for instantiating correct event
Instance Method Summary collapse
- #constantize(camel_cased_word) ⇒ Object
- #demodulize(path) ⇒ Object
- #resolve(message, session) ⇒ Object
Instance Method Details
#constantize(camel_cased_word) ⇒ Object
53 54 55 |
# File 'lib/wamp/manager/event.rb', line 53 def constantize(camel_cased_word) Object.const_get(camel_cased_word) end |
#demodulize(path) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/wamp/manager/event.rb', line 44 def demodulize(path) path = path.to_s if i = path.rindex("::") # rubocop:disable Lint/AssignmentInCondition path[(i + 2), path.length] else path end end |
#resolve(message, session) ⇒ Object
38 39 40 41 42 |
# File 'lib/wamp/manager/event.rb', line 38 def resolve(, session) klass_name = demodulize(.class.name) klass = constantize("Wamp::Manager::Event::#{klass_name}") klass.new(, session) end |