Sha256: b3c55b298e07f6786b4d83a85af7685dc2928f50001c0faaa6816cb98fe7db2f
Contents?: true
Size: 525 Bytes
Versions: 64
Compression:
Stored size: 525 Bytes
Contents
# The original Module class. # class Module def each_delegate *methods options = methods.pop unless options.is_a?(Hash) && to = options[:to] raise ArgumentError, "Multi delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :something, :to => :an_array_reader)." end methods.each do |method| module_eval("def #{method}(*args, &block)\n#{to}.each{ |t| t.__send__(#{method.inspect}, *args, &block) }\nend\n", "(__DELEGATION__)", 1) end end end
Version data entries
64 entries across 64 versions & 1 rubygems