Module: CaptainHoog::Delegatable::InstanceMethods

Defined in:
lib/captain_hoog/delegatable.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



20
21
22
23
24
25
26
# File 'lib/captain_hoog/delegatable.rb', line 20

def method_missing(method_name, *args, &block)
  if delegate_to.respond_to?(method_name)
    delegate_to.send(method_name, *args, &block)
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/captain_hoog/delegatable.rb', line 28

def respond_to_missing?(method_name, include_private=false)
  delegate_to.respond_to?(method_name) || super
end