Sha256: 955e76890e336ce4ab924812918ce4ffc91bc6875fe65e2b8466228424dff54a

Contents?: true

Size: 579 Bytes

Versions: 7

Compression:

Stored size: 579 Bytes

Contents

class Hash
  # New Ruby 1.8.7+ constructor -- not documented, see redmine # 1385
  # <tt>Hash[[[:foo, :bar],[:hello, "world"]]] ==> {:foo => :bar, :hello => "world"}</tt>
  class << self
    def try_convert(x)
      return nil unless x.respond_to? :to_hash
      x.to_hash
    end unless method_defined? :try_convert
  end
  
  # Standard in Ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Hash.html]
  def default_proc=(proc)
    replace(Hash.new(&Backports.coerce_to(proc, Proc, :to_proc)).merge!(self))
  end unless method_defined? :default_proc=
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
backports-1.11.2 lib/backports/1.9/hash.rb
backports-1.11.1 lib/backports/1.9/hash.rb
backports-1.11.0 lib/backports/1.9/hash.rb
backports-1.10.3 lib/backports/1.9/hash.rb
backports-1.10.2 lib/backports/1.9/hash.rb
backports-1.10.1 lib/backports/1.9/hash.rb
backports-1.10.0 lib/backports/1.9/hash.rb