Class: Struct

Inherits:
Object
  • Object
show all
Defined in:
lib/struct2json.rb

Instance Method Summary collapse

Instance Method Details

#to_json(*a) ⇒ Object



10
11
12
# File 'lib/struct2json.rb', line 10

def to_json(*a)
  to_map.to_json(*a)
end

#to_mapObject



4
5
6
7
8
# File 'lib/struct2json.rb', line 4

def to_map
  map = Hash.new
  self.members.each { |m| map[m] = self[m] }   
  map 
end