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



177
178
179
180
181
# File 'lib/epitools/core_ext/misc.rb', line 177

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.



186
187
188
# File 'lib/epitools/core_ext/misc.rb', line 186

def to_json(*args)
  to_hash.to_json
end