Class: Struct

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

Direct Known Subclasses

Screencast

Instance Method Summary collapse

Instance Method Details

#to_json(*a) ⇒ Object



13
14
15
# File 'lib/railscasts.rb', line 13

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

#to_mapObject



7
8
9
10
11
# File 'lib/railscasts.rb', line 7

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