Sha256: 62348b8bf2bdcc3acb1be8945ccdab0dea78b1beb0018725dad93a832c388366

Contents?: true

Size: 422 Bytes

Versions: 84

Compression:

Stored size: 422 Bytes

Contents

class Object

  def nested_send(symbol)
    return __send__(symbol) if respond_to?(symbol)
    obj = nil
    symbol.to_s.split('.').each do |part|
      nested_symbol = part.to_sym
      if obj
        break unless obj.respond_to?(nested_symbol)
        obj = obj.__send__(nested_symbol)
      else
        break unless respond_to?(nested_symbol)
        obj = __send__(nested_symbol)
      end
    end
    obj
  end

end

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
redmine_extensions-0.6.3 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.6.2 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.6.1 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.6.0 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.4.5 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.5.1 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.4.4 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.4.3 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.4.1 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.4.0 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.4.0.beta lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.3.11 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.3.10 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.3.9 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.3.8 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.3.7 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.3.6 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.3.4 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.3.3 lib/redmine_extensions/core_ext/object.rb
redmine_extensions-0.3.2 lib/redmine_extensions/core_ext/object.rb