Class: OpenStruct
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
- #each_pair ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
- #to_h ⇒ Object
Instance Method Details
#[](name) ⇒ Object
2 3 4 |
# File 'lib/backports/2.0.0/stdlib/ostruct.rb', line 2 def [](name) @table[name.to_sym] end |
#[]=(name, value) ⇒ Object
6 7 8 |
# File 'lib/backports/2.0.0/stdlib/ostruct.rb', line 6 def []=(name, value) modifiable[new_ostruct_member(name)] = value end |
#each_pair ⇒ Object
19 20 21 22 |
# File 'lib/backports/2.0.0/stdlib/ostruct.rb', line 19 def each_pair return to_enum(:each_pair) unless block_given? @table.each_pair{|p| yield p} end |
#eql?(other) ⇒ Boolean
10 11 12 13 |
# File 'lib/backports/2.0.0/stdlib/ostruct.rb', line 10 def eql?(other) return false unless other.kind_of?(OpenStruct) @table.eql?(other.table) end |
#hash ⇒ Object
15 16 17 |
# File 'lib/backports/2.0.0/stdlib/ostruct.rb', line 15 def hash @table.hash end |
#to_h ⇒ Object
24 25 26 |
# File 'lib/backports/2.0.0/stdlib/ostruct.rb', line 24 def to_h @table.dup end |