Class: Occi::Core::Renderers::TextRenderer

Inherits:
BaseRenderer show all
Defined in:
lib/occi/core/renderers/text_renderer.rb

Overview

Implementes components necessary to render all required instance types to `text` or `text`-like format. Currently supported instance types can be queried via `::known_types`. Actual serialization happens in type-specific serializer classes which can be found in `Occi::Core::Renderers::Text`.

Author:

Constant Summary collapse

TEXT_FORMATS =

Supported formats

%w[text text_plain text_occi headers].freeze

Class Method Summary collapse

Methods inherited from BaseRenderer

known_serializers, known_types, render

Class Method Details

.formatsArray

Returns a list of formats supported by this renderer. Formats are compliant with method naming restrictions and String-like.

Returns:

  • (Array)

    list of formats


50
51
52
# File 'lib/occi/core/renderers/text_renderer.rb', line 50

def formats
  TEXT_FORMATS
end

.knownArray

Returns a frozen Hash providing mapping information between supported types and supported serializers.

Returns:

  • (Array)

    list of known type->serializer mappings


58
59
60
61
62
63
64
65
66
67
68
# File 'lib/occi/core/renderers/text_renderer.rb', line 58

def known
  {
    'Occi::Core::Category'       => Occi::Core::Renderers::Text::Category,
    'Occi::Core::ActionInstance' => Occi::Core::Renderers::Text::ActionInstance,
    'Occi::Core::Collection'     => Occi::Core::Renderers::Text::Collection,
    'Occi::Core::Model'          => Occi::Core::Renderers::Text::Model,
    'Occi::Core::Resource'       => Occi::Core::Renderers::Text::Resource,
    'Occi::Core::Link'           => Occi::Core::Renderers::Text::Link,
    'Occi::Core::Locations'      => Occi::Core::Renderers::Text::Locations
  }
end

.renderer?TrueClass, FalseClass

Indicates whether this class is a renderer candidate.

Returns:


41
42
43
# File 'lib/occi/core/renderers/text_renderer.rb', line 41

def renderer?
  true
end