Implements methods needed to render collection instances to text-based renderings. This class (its instances) is usually called directly from the “outside”. It utilizes `Model` from this module to render kinds, actions, and mixins. As well as `Resource`, `Link`, and `ActionInstance`.
@author Boris Parak <parak@cesnet.cz>
Renders `object` into text for headers and returns the result as `Hash`.
@return [Hash] textual representation of Object for headers
# File lib/occi/core/renderers/text/collection.rb, line 35 def render_headers return {} if object_empty? || object.only_categories? if ent_no_ai? prepare_instances 'entities' elsif ai_no_ent? prepare_instances 'action_instances' else raise Occi::Core::Errors::RenderingError, 'Cannot render mixed collection to text headers' end end
Renders `object` into plain text and returns the result as `String`.
@return [String] textual representation of Object
# File lib/occi/core/renderers/text/collection.rb, line 18 def render_plain return '' if object_empty? || object.only_categories? if ent_no_ai? prepare_instances 'entities' elsif ai_no_ent? prepare_instances 'action_instances' else raise Occi::Core::Errors::RenderingError, 'Cannot render mixed collection to plain text' end end