Class: OStruct
Instance Method Summary collapse
-
#initialize(hash = nil) ⇒ OStruct
constructor
A new instance of OStruct.
- #pp ⇒ Object
- #to_h ⇒ Object
- #to_sig ⇒ Object
- #|(other_ostruct) ⇒ Object
Constructor Details
#initialize(hash = nil) ⇒ OStruct
Returns a new instance of OStruct.
391 392 393 394 395 396 397 398 399 |
# File 'lib/shorthand.rb', line 391 def initialize(hash=nil) @table = OrderedHash.new if hash for k,v in hash @table[k.to_sym] = v new_ostruct_member(k) end end end |
Instance Method Details
#pp ⇒ Object
402 |
# File 'lib/shorthand.rb', line 402 def pp() marshal_dump.map{|k,v| "#{k.to_s.ljust(24)} = #{String===v ? v : v.pretty_inspect.strip}"}.join("\n") end |
#to_h ⇒ Object
401 |
# File 'lib/shorthand.rb', line 401 def to_h() self.marshal_dump end |
#to_sig ⇒ Object
404 |
# File 'lib/shorthand.rb', line 404 def to_sig() marshal_dump.to_sig end |