Class: Struct

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudformation-ruby-dsl/cfntemplate.rb

Overview

utility class to deserialize Structs as JSON borrowed from ruhe.tumblr.com/post/565540643/generate-json-from-ruby-struct

Instance Method Summary collapse

Instance Method Details

#to_json(*a) ⇒ Object



63
64
65
# File 'lib/cloudformation-ruby-dsl/cfntemplate.rb', line 63

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

#to_mapObject



57
58
59
60
61
# File 'lib/cloudformation-ruby-dsl/cfntemplate.rb', line 57

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