class Occi::Core::Renderers::Text::Model

Implements methods needed to render model instances to text-based renderings. This class (its instances) is usually called directly from the “outside”. It utilizes `Category` from this module to render kinds, actions, and mixins.

@author Boris Parak <parak@cesnet.cz>

Public Instance Methods

render_headers() click to toggle source

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/model.rb, line 28
def render_headers
  rcats = { Category.category_key_headers => [] }
  object.categories.each do |cat|
    rcats[Category.category_key_headers].concat(
      Category.new(cat, options).render[Category.category_key_headers]
    )
  end
  rcats
end
render_plain() click to toggle source

Renders `object` into plain text and returns the result as `String`.

@return [String] textual representation of Object

# File lib/occi/core/renderers/text/model.rb, line 19
def render_plain
  rcats = object.categories.collect { |cat| Category.new(cat, options).render }
  rcats.join("\n")
end