Module: Nuggets::Object::MSendMixin

Included in:
Object
Defined in:
lib/nuggets/object/msend_mixin.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) msend(*messages)

call-seq:

object.msend(*messages) => anArray

Sends object multiple messages and returns an array of the individual return values.



37
38
39
40
# File 'lib/nuggets/object/msend_mixin.rb', line 37

def msend(*messages)
  hash = messages.last.is_a?(::Hash) ? messages.pop : {}
  (messages + hash.to_a).map { |msg| send(*msg.is_a?(::Array) ? msg : [msg]) }
end