class PlainSite::Utils::ObjectProxy

Attributes

objects[R]

Public Class Methods

new(*objects) click to toggle source
# File lib/PlainSite/Utils.rb, line 8
def initialize(*objects)
  @objects=objects
end

Public Instance Methods

<<(*objects) click to toggle source
# File lib/PlainSite/Utils.rb, line 12
def <<(*objects)
  @objects.concat objects
end
clone() click to toggle source
# File lib/PlainSite/Utils.rb, line 20
def clone
  ObjectProxy.new self
end
dup() click to toggle source
# File lib/PlainSite/Utils.rb, line 16
def dup
  ObjectProxy.new *@objects
end
get_binding() click to toggle source
# File lib/PlainSite/Utils.rb, line 51
def get_binding
  binding
end
method_missing(name,*args,&block) click to toggle source
Calls superclass method
# File lib/PlainSite/Utils.rb, line 31
def method_missing(name,*args,&block)
  o=@objects.detect {|o|o.respond_to? name}
  if o
    define_singleton_method(name) do |*a,&b|
      o.send name,*a,&b
    end
    return o.send name,*args,&block
  end
  if args.empty? && block.nil?
    o=@objects.detect {|o|(o.respond_to? :key?) && ((o.key? name) || (o.key? name.to_s))}
    if o
      define_singleton_method(name) do
        o[name] || o[name.to_s]
      end
      return o[name] || o[name.to_s]
    end
  end
  super
end
respond_to?(name) click to toggle source
Calls superclass method
# File lib/PlainSite/Utils.rb, line 24
def respond_to?(name)
  return true if @objects.any? do |o|
    o.respond_to? name || ((o.respond_to? :key?) && ((o.key? name) || (o.key? name.to_s)))
  end
  super
end