Sha256: e0bf1ba581a159a4bc79fe920c6a500c6008ce23dfa9d25f76cfc7269faa8a2a
Contents?: true
Size: 359 Bytes
Versions: 1
Compression:
Stored size: 359 Bytes
Contents
class Object def try(*a, &b) if a.empty? && block_given? yield self else public_send(*a, &b) if respond_to?(a.first) end end def try!(*a, &b) if a.empty? && block_given? yield self else public_send(*a, &b) end end end class NilClass def try(*args) nil end def try!(*args) nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
happy_support-1.0.0 | lib/happy_support/core_ext/object/try.rb |