Sha256: b6631384996ea65ca4325c1eb8e222a17b028a23b1d05204ac04bb1b527265ba

Contents?: true

Size: 243 Bytes

Versions: 6

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

6 entries across 6 versions & 1 rubygems

Version Path
geokit-1.8.5 lib/geokit/core_ext.rb
geokit-1.8.4 lib/geokit/core_ext.rb
geokit-1.8.3 lib/geokit/core_ext.rb
geokit-1.8.2 lib/geokit/core_ext.rb
geokit-1.8.1 lib/geokit/core_ext.rb
geokit-1.8.0 lib/geokit/core_ext.rb