class Occi::Core::Renderers::Text::Resource

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

@author Boris Parak <parak@cesnet.cz>

Constants

Link key constant

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/resource.rb, line 36
def render_headers
  headers = short_category(object.kind)
  headers[Category.category_key_headers].concat(
    short_mixins_headers
  )
  headers.merge!(instance_attributes)
  headers.merge!(header_links)

  headers
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/resource.rb, line 25
def render_plain
  [
    short_category(object.kind), short_mixins_plain, instance_attributes,
    instance_links, instance_actions
  ].flatten.join("\n")
end