class Occi::Core::Renderers::Text::Locations

Implements routines required to render `Occi::Core::Locations` and its subclasses to a text-based representation. Supports rendering to plain and header-like formats.

@author Boris Parak <parak@cesnet.cz>

Constants

LOCATION_KEY_HEADERS
LOCATION_KEY_PLAIN

Location key constants

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/locations.rb, line 30
def render_headers
  return {} if object.empty?
  { LOCATION_KEY_HEADERS => location_ary_or_first }
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/locations.rb, line 21
def render_plain
  locs = object.map { |loc| "#{LOCATION_KEY_PLAIN}: #{loc}" }
  locs.join "\n"
end