Class: CloudBuilder::JSONable

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

Direct Known Subclasses

Output, Parameter

Instance Method Summary collapse

Instance Method Details

#to_hashObject



3
4
5
6
7
8
9
10
# File 'lib/cloud_builder/jsonable.rb', line 3

def to_hash
  hash = {}
      
  self.instance_variables.each do |var|
      hash[var.to_s.delete("@")] = self.instance_variable_get var
  end
  hash
end

#to_json(*a) ⇒ Object



12
13
14
# File 'lib/cloud_builder/jsonable.rb', line 12

def to_json(*a)
    self.to_hash.to_json(*a)
end