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



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

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

#to_mapObject



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

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