Class: Occi::Core::Renderers::Json::Model

Inherits:
Base
  • Object
show all
Defined in:
lib/occi/core/renderers/json/model.rb

Overview

Implements routines required to render `Occi::Core::Model` and its subclasses to a JSON-based representation.

Author:

Direct Known Subclasses

Collection

Constant Summary

Constants inherited from Base

Base::DELEGATED

Instance Attribute Summary

Attributes inherited from Base

#object, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize, #render

Constructor Details

This class inherits a constructor from Occi::Core::Renderers::Json::Base

Instance Method Details

#render_hashObject

:nodoc:


14
15
16
17
18
19
20
21
# File 'lib/occi/core/renderers/json/model.rb', line 14

def render_hash
  hsh = {}
  %i[actions kinds mixins].each do |symbol|
    next if object_send(symbol).blank?
    hsh[symbol] = object_send(symbol).collect { |k| Category.new(k, options).render_hash }
  end
  hsh
end