Class: ActiveMessenger::Base

Inherits:
Object
  • Object
show all
Includes:
Core::ConfigParsable, Core::Postable
Defined in:
lib/active_messenger/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Core::Postable

#send!

Constructor Details

#initializeBase

Returns a new instance of Base.



17
18
19
# File 'lib/active_messenger/base.rb', line 17

def initialize
  @adapter = self.class.adapter_class.new
end

Class Method Details

.adapter(adapter_sym) ⇒ Object



22
23
24
# File 'lib/active_messenger/base.rb', line 22

def adapter(adapter_sym)
  self.adapter = adapter_sym
end

.adapter_classObject



26
27
28
# File 'lib/active_messenger/base.rb', line 26

def adapter_class
 "ActiveMessenger::Adapters::#{self.adapter.to_s.classify}".constantize
end

.method_missing(method_name, *args, &block) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/active_messenger/base.rb', line 30

def method_missing(method_name, *args, &block)
  if self.adapter_class.respond_to?(method_name)
    self.adapter_class.__send__(method_name, *args, &block)
  else
    super
  end
end