Class: Occi::Core::Renderers::Json::Base
- Inherits:
-
Object
- Object
- Occi::Core::Renderers::Json::Base
- Includes:
- Yell::Loggable
- Defined in:
- lib/occi/core/renderers/json/base.rb
Overview
Implements methods common to all JSON-based renderers. This class is not meant to be used directly, only as a parent to other type-specific rendering classes.
Direct Known Subclasses
ActionInstance, Attributes, Category, Link, Locations, Model, Resource
Constant Summary collapse
- DELEGATED =
Shortcuts to interesting object attributes, always prefixed with ‘object_`
%i[ respond_to? send source target summary kind parent action attributes actions mixins depends applies rel empty? categories entities resources links action_instances ].freeze
Instance Attribute Summary collapse
-
#object ⇒ Object
instance to be rendered.
-
#options ⇒ Hash
additional rendering options.
Instance Method Summary collapse
-
#initialize(object, options) ⇒ Base
constructor
Constructs a renderer instance for the given object.
-
#render ⇒ String
Renders the given object to ‘JSON`.
Constructor Details
#initialize(object, options) ⇒ Base
Constructs a renderer instance for the given object.
31 32 33 34 |
# File 'lib/occi/core/renderers/json/base.rb', line 31 def initialize(object, ) @object = object @options = end |
Instance Attribute Details
#object ⇒ Object
instance to be rendered
13 14 15 |
# File 'lib/occi/core/renderers/json/base.rb', line 13 def object @object end |
#options ⇒ Hash
additional rendering options
13 14 15 |
# File 'lib/occi/core/renderers/json/base.rb', line 13 def @options end |
Instance Method Details
#render ⇒ String
Renders the given object to ‘JSON`.
39 40 41 |
# File 'lib/occi/core/renderers/json/base.rb', line 39 def render render_hash.to_json end |