class Hatt::BlankSlateProxy
A simple 'blankslate' class which is used to avoid namespace polution Provides a proxy to a parent class, in order to allow access to other hatt methods like http service objects
TODO: Figure out if can/should use a BasicObject here. I know it wont work right now because the binding method of Object is needed and not in BasicObject
Public Class Methods
new(parent)
click to toggle source
# File lib/hatt/blankslateproxy.rb, line 9 def initialize(parent) @parent = parent end
Public Instance Methods
method_missing(method_id, *arguments, &block)
click to toggle source
Calls superclass method
# File lib/hatt/blankslateproxy.rb, line 13 def method_missing(method_id, *arguments, &block) if parent_has_method?(method_id) @parent.send(method_id, *arguments, &block) else super end end
parent_has_method?(name, include_private = false)
click to toggle source
# File lib/hatt/blankslateproxy.rb, line 21 def parent_has_method?(name, include_private = false) if include_private @parent.methods.include?(name.to_sym) else @parent.public_methods.include?(name.to_sym) end end
respond_to_missing?(name, include_private = false)
click to toggle source
Calls superclass method
# File lib/hatt/blankslateproxy.rb, line 29 def respond_to_missing?(name, include_private = false) parent_has_method?(name, include_private) || super end