Sha256: 45bf4d924663da9f674a422c10da3afd4111f7f39ede1dffcd40c86826d7ab73

Contents?: true

Size: 243 Bytes

Versions: 5

Compression:

Stored size: 243 Bytes

Contents

unless nil.respond_to?(:try)
  class Object
    def try(*a, &b)
      if a.empty? && block_given?
        yield self
      else
        __send__(*a, &b)
      end
    end
  end

  class NilClass
    def try(*_args)
      nil
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geokit-1.14.0 lib/geokit/core_ext.rb
geokit-1.13.1 lib/geokit/core_ext.rb
geokit-1.13.0 lib/geokit/core_ext.rb
geokit-1.12.0 lib/geokit/core_ext.rb
geokit-1.11.0 lib/geokit/core_ext.rb