Class: Struct
Direct Known Subclasses
Instance Method Summary collapse
-
#to_hash ⇒ Object
Transform this struct into a JSON hash.
-
#to_json(*args) ⇒ Object
Transform the struct into a simple JSON hash.
Instance Method Details
#to_hash ⇒ Object
Transform this struct into a JSON hash
114 115 116 117 118 |
# File 'lib/epitools/core_ext/misc.rb', line 114 def to_hash hash = {} each_pair { |k,v| hash[k] = v } hash end |
#to_json(*args) ⇒ Object
Transform the struct into a simple JSON hash.
123 124 125 |
# File 'lib/epitools/core_ext/misc.rb', line 123 def to_json(*args) to_hash.to_json end |