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



72
73
74
# File 'lib/cloudformation-ruby-dsl/cfntemplate.rb', line 72

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

#to_mapObject



66
67
68
69
70
# File 'lib/cloudformation-ruby-dsl/cfntemplate.rb', line 66

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