Module: Intercom::Traits::GenericHandlerBinding::ClassMethods

Defined in:
lib/intercom/traits/generic_handler_binding.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *arguments, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/intercom/traits/generic_handler_binding.rb', line 9

def method_missing(method_sym, *arguments, &block)
  if respond_to? :generic_tag and GenericHandlers::Tag.handles_method?(method_sym)
    return generic_tag(method_sym, *arguments, block)
  elsif respond_to? :generic_tag_find_all and GenericHandlers::TagFindAll.handles_method?(method_sym)
    return generic_tag_find_all(method_sym, *arguments, block)
  elsif respond_to? :generic_count and GenericHandlers::Count.handles_method?(method_sym)
    return generic_count(method_sym, *arguments, block)
  end
  super
rescue Intercom::NoMethodMissingHandler
  super
end