Class: RightScale::MetadataFormatter
- Defined in:
- lib/clouds/metadata_formatter.rb
Overview
Abstracts a formatter which maps one kind of metadata output to another.
Constant Summary collapse
- RS_METADATA_PREFIX =
RS_ is reserved for use by RightScale and should be avoided by users passing non-RightScale metadata to instances.
'RS_'
Instance Attribute Summary collapse
-
#format_metadata_override ⇒ Object
Returns the value of attribute format_metadata_override.
-
#formatted_path_prefix ⇒ Object
Returns the value of attribute formatted_path_prefix.
Instance Method Summary collapse
-
#format_metadata(metadata) ⇒ Object
Formats metadata such that any hierarchical details flattened into simple key names.
-
#initialize(options = {}) ⇒ MetadataFormatter
constructor
Initializer.
Constructor Details
#initialize(options = {}) ⇒ MetadataFormatter
39 40 41 42 43 44 45 |
# File 'lib/clouds/metadata_formatter.rb', line 39 def initialize( = {}) # options @formatted_path_prefix = [:formatted_path_prefix] || RS_METADATA_PREFIX # overrides = [:format_metadata_override] end |
Instance Attribute Details
#format_metadata_override ⇒ Object
Returns the value of attribute format_metadata_override.
32 33 34 |
# File 'lib/clouds/metadata_formatter.rb', line 32 def end |
#formatted_path_prefix ⇒ Object
Returns the value of attribute formatted_path_prefix.
32 33 34 |
# File 'lib/clouds/metadata_formatter.rb', line 32 def formatted_path_prefix @formatted_path_prefix end |
Instance Method Details
#format_metadata(metadata) ⇒ Object
Formats metadata such that any hierarchical details flattened into simple key names.
Parameters
- tree_metadata(Hash)
-
tree of raw metadata
Returns
- flat_metadata(Hash)
-
flattened metadata
55 56 57 58 |
# File 'lib/clouds/metadata_formatter.rb', line 55 def () return .call(self, ) if return () end |