Sha256: 865034f388fe77f67df760460e0ed4bda272125dbf8776f691ded7df543a4e23

Contents?: true

Size: 191 Bytes

Versions: 4

Compression:

Stored size: 191 Bytes

Contents

class Object
  def try(*args, &block)
    return nil if self.nil?
    block_given? ? yield(self) : self.__send__(args.shift, *args)
  end

  def tap
    yield(self)
    return self
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
darkhelmet-darkext-0.11.1 lib/darkext/object.rb
darkhelmet-darkext-0.11.2 lib/darkext/object.rb
darkhelmet-darkext-0.12.0 lib/darkext/object.rb
darkext-0.12.0 lib/darkext/object.rb