Module: Occi::Core::Renderers::Json::Instance
Overview
Implements methods needed to render multiple instance types to JSON-based renderings.
Instance Method Summary collapse
-
#render_attributes_hash ⇒ Object
:nodoc:.
-
#render_instance_hash ⇒ Object
:nodoc:.
Instance Method Details
#render_attributes_hash ⇒ Object
:nodoc:
32 33 34 |
# File 'lib/occi/core/renderers/json/instance.rb', line 32 def render_attributes_hash Attributes.new(object_attributes, ).render_hash end |
#render_instance_hash ⇒ Object
:nodoc:
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/occi/core/renderers/json/instance.rb', line 13 def render_instance_hash hsh = {} hsh[:kind] = object_kind.to_s i[mixins actions].each do |symbol| hsh[symbol] = object_send(symbol).collect(&:to_s) unless object_send(symbol).blank? end hsh[:attributes] = render_attributes_hash unless object_attributes.blank? i[id title].each do |symbol| next unless object_send(symbol) hsh[symbol] = object_send(symbol) end hsh end |