Class: Occi::Core::Renderers::Text::Attributes
- Defined in:
- lib/occi/core/renderers/text/attributes.rb
Overview
Implements methods needed to render instance attributes to text-based renderings. This class (its instances) is usually called directly from other classes in this module and not from the “outside”.
Constant Summary collapse
- ATTRIBUTE_KEY =
Attribute key constant
'X-OCCI-Attribute'.freeze
- PRIMITIVE_TYPES =
Known primitive attribute value types
[String, Numeric, Integer, Float, Boolean].freeze
- IP_TYPES =
[IPAddr].freeze
- QUOTABLE_TYPES =
[URI].freeze
- JSONABLE_TYPES =
[Array, Hash].freeze
Constants inherited from Base
Base::DELEGATED, Base::RENDER_SAFE
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#render_headers ⇒ Hash
Renders ‘object` into text for headers and returns the result as `Hash`.
-
#render_plain ⇒ String
Renders ‘object` into plain text and returns the result as `String`.
Methods inherited from Base
#initialize, #render, #render_safe, render_safe
Constructor Details
This class inherits a constructor from Occi::Core::Renderers::Text::Base
Instance Method Details
#render_headers ⇒ Hash
Renders ‘object` into text for headers and returns the result as `Hash`.
34 35 36 |
# File 'lib/occi/core/renderers/text/attributes.rb', line 34 def render_headers { ATTRIBUTE_KEY => prepare_instance_attributes } end |
#render_plain ⇒ String
Renders ‘object` into plain text and returns the result as `String`.
26 27 28 |
# File 'lib/occi/core/renderers/text/attributes.rb', line 26 def render_plain prepare_instance_attributes.collect { |attrb| "#{ATTRIBUTE_KEY}: #{attrb}" }.join("\n") end |