Class: Analytical::Api::ImmediateDelegateHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/analytical/api.rb

Overview

Delegation class that passes methods to

Instance Method Summary collapse

Constructor Details

#initialize(_parent) ⇒ ImmediateDelegateHelper

Returns a new instance of ImmediateDelegateHelper.



45
46
47
# File 'lib/analytical/api.rb', line 45

def initialize(_parent)
  @parent = _parent
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



48
49
50
51
52
# File 'lib/analytical/api.rb', line 48

def method_missing(method, *args, &block)
  @parent.modules.values.collect do |m|
    m.send(method, *args) if m.respond_to?(method)
  end.delete_if{|c| c.blank?}.join("\n")
end