Module: WGObjectExtensions

Included in:
Object
Defined in:
lib/wice/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



129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/wice/wice_grid_core_ext.rb', line 129

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
  obj
end