Class: Struct

Inherits:
Object show all
Defined in:
lib/epitools/core_ext/misc.rb

Direct Known Subclasses

Sys::ProcessInfo, TypedStruct

Instance Method Summary collapse

Instance Method Details

#to_hashObject

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