class Occi::Core::Renderers::Text::Category

Implements routines required to render `Occi::Core::Category` and its subclasses to a text-based representation. Supports rendering to plain and header-like formats. Internally, the rendering itself is done via ERB templates.

@author Boris Parak <parak@cesnet.cz>

Constants

CATEGORY_KEY_HEADERS
CATEGORY_KEY_PLAIN

Category key constants

Public Class Methods

category_key_headers() click to toggle source

Returns word used to key all categories rendered to headers.

@return [String] category key

# File lib/occi/core/renderers/text/category.rb, line 61
def category_key_headers
  CATEGORY_KEY_HEADERS
end
category_key_plain() click to toggle source

Returns keyword used to prefix all categories rendered to plain text.

@return [String] category keyword

# File lib/occi/core/renderers/text/category.rb, line 54
def category_key_plain
  CATEGORY_KEY_PLAIN
end

Public Instance Methods

category_key_headers() click to toggle source

Returns word used to key all categories rendered to headers.

@return [String] category key

# File lib/occi/core/renderers/text/category.rb, line 46
def category_key_headers
  CATEGORY_KEY_HEADERS
end
category_key_plain() click to toggle source

Returns keyword used to prefix all categories rendered to plain text.

@return [String] category keyword

# File lib/occi/core/renderers/text/category.rb, line 39
def category_key_plain
  CATEGORY_KEY_PLAIN
end
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/category.rb, line 31
def render_headers
  obj_data = object_data
  { CATEGORY_KEY_HEADERS => [erb_render(obj_data)] }
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/category.rb, line 22
def render_plain
  obj_data = object_data
  "#{CATEGORY_KEY_PLAIN}: #{erb_render(obj_data)}"
end