module Hatt::SingletonMixin

Public Class Methods

hatt_instance() click to toggle source
# File lib/hatt/singleton_mixin.rb, line 9
def hatt_instance
  @@hatt_instance ||= InitOnceHattClass.new
end

Public Instance Methods

hatt_instance_has_method?(name, include_private = false) click to toggle source
# File lib/hatt/singleton_mixin.rb, line 22
def hatt_instance_has_method?(name, include_private = false)
  if include_private
    hatt_instance.methods.include?(name.to_sym)
  else
    hatt_instance.public_methods.include?(name.to_sym)
  end
end
method_missing(method_id, *arguments, &block) click to toggle source
Calls superclass method
# File lib/hatt/singleton_mixin.rb, line 14
def method_missing(method_id, *arguments, &block)
  if hatt_instance_has_method?(method_id)
    hatt_instance.send(method_id, *arguments, &block)
  else
    super
  end
end
respond_to_missing?(name, include_private = false) click to toggle source
Calls superclass method
# File lib/hatt/singleton_mixin.rb, line 30
def respond_to_missing?(name, include_private = false)
  hatt_instance_has_method?(name, include_private) || super
end

Private Instance Methods

hatt_instance() click to toggle source
# File lib/hatt/singleton_mixin.rb, line 9
def hatt_instance
  @@hatt_instance ||= InitOnceHattClass.new
end