Module: WGObjectExtensions

Included in:
Object
Defined in:
lib/wice_grid_core_ext.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#deep_send(*messages) ⇒ Object

takes a list of messages, sends message 1 to self, then message 2 is sent to the result of the first message, ans so on returns nil as soon as the current receiver does not respond to such a message



137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/wice_grid_core_ext.rb', line 137

def deep_send(*messages)  #:nodoc:
  obj = self
  messages.each do |message|
    if obj.respond_to? message
      obj = obj.send(message)
    else
      return nil
    end
    # return obj if obj.nil?
  end
  return obj
end