Method: StarkInfra::Utils::API.build_entity_hash
- Defined in:
- lib/utils/api.rb
permalink .build_entity_hash(entity) ⇒ Object
[View source]
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/utils/api.rb', line 8 def self.build_entity_hash(entity) if entity.is_a?(Hash) entity_hash = entity else entity_hash = {} entity.instance_variables.each do |key| variable = entity.instance_variable_get(key) entity_hash[key[1..-1]] = variable.is_a?(StarkInfra::Utils::Resource) ? build_entity_hash(variable) : entity.instance_variable_get(key) end end entity_hash end |