Sha256: 9dda524876cb573dd9e330ec87d8ddf7c0754bcea1821b6b88302323bb384bc2
Contents?: true
Size: 999 Bytes
Versions: 2
Compression:
Stored size: 999 Bytes
Contents
module RG class Proxy attr_reader :objs def initialize(mode, objs) case mode when :single p_init_single(objs) when :multiple p_init_multiple(objs) else fail ArgumentError, "Invalid mode" end end def p_init_single(obj) @objs = [obj] end def p_init_multiple(objs) init_single(objs) if objs.class != Array @objs = objs cl = @objs[0].class @objs.each do |o| fail(ArgumentError, "Objects' Classes are not same!") if (o.class != cl) end end def method_missing(m, *args, &block) results = [] @objs.each do |o| results << o.send(m, *args, &block) end results end def p_eval(dat) results = [] @objs.each do |o| results << o.instance_eval(dat) end results end def p_inspect() results = [] @objs.each do |o| results << o.inspect end results end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubygoods-0.0.1.1 | lib/rubygoods/proxy.rb |
rubygoods-0.0.1 | lib/rubygoods/proxy.rb |