Sha256: 5b85840ea33b3cb35aa5838543ee0c6fbc5e9afce034de34edfb616524378dd1

Contents?: true

Size: 600 Bytes

Versions: 4

Compression:

Stored size: 600 Bytes

Contents

class OpenStruct
  def [](name)
    @table[name.to_sym]
  end unless method_defined? :[]

  def []=(name, value)
    modifiable[new_ostruct_member(name)] = value
  end unless method_defined? :[]=

  def eql?(other)
    return false unless other.kind_of?(OpenStruct)
    @table.eql?(other.table)
  end unless method_defined? :eql?

  def hash
    @table.hash
  end unless method_defined? :hash

  def each_pair
    return to_enum __method__ unless block_given?
    @table.each_pair{|p| yield p}
  end unless method_defined? :each_pair

  def to_h
    @table.dup
  end unless method_defined? :to_h
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
backports-3.0.3 lib/backports/2.0.0/stdlib/ostruct.rb
backports-3.0.2 lib/backports/2.0.0/stdlib/ostruct.rb
backports-3.0.1 lib/backports/2.0.0/stdlib/ostruct.rb
backports-3.0.0 lib/backports/2.0.0/stdlib/ostruct.rb