Sha256: e95bc722e57b10f4ed2cec0f2328d56b6c4415dd8d13f7c2927efb4df837f314
Contents?: true
Size: 774 Bytes
Versions: 10
Compression:
Stored size: 774 Bytes
Contents
module Surrounded module Context module Forwarding def forward_trigger(receiver, message, alternate=message) raise(ArgumentError, %{you may not forward '%{m}`} % {m: message}) if ['__id__','__send__'].include?(message.to_s) trigger alternate do |*args, &block| self.send(receiver).public_send(message,*args, &block) end end def forward_triggers(receiver, *messages) messages.each do |message| forward_trigger(receiver, message) end end def forwarding(hash) hash.each { |messages, receiver| forward_triggers(receiver, *messages) } end alias forward forward_trigger alias forwards forward_triggers end end end
Version data entries
10 entries across 10 versions & 1 rubygems