Module: RightSupport::Ruby::EasySingleton::ClassMethods

Defined in:
lib/right_support/ruby/easy_singleton.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



28
29
30
31
32
33
34
# File 'lib/right_support/ruby/easy_singleton.rb', line 28

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

Instance Method Details

#respond_to?(meth, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/right_support/ruby/easy_singleton.rb', line 36

def respond_to?(meth, include_all=false)
  super || self.instance.respond_to?(meth, include_all)
end

#respond_to_missing?(meth, include_all = false) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/right_support/ruby/easy_singleton.rb', line 40

def respond_to_missing?(meth, include_all=false)
  super || self.instance.respond_to?(meth, include_all)
end