Class: Fluent::Plugin::ElasticsearchStats::Metadata
- Inherits:
-
Object
- Object
- Fluent::Plugin::ElasticsearchStats::Metadata
- Defined in:
- lib/fluent/plugin/elasticsearch_stats/metadata.rb
Class Attribute Summary collapse
-
.metadata_prefix ⇒ Object
Returns the value of attribute metadata_prefix.
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#metadata_prefix ⇒ Object
readonly
Returns the value of attribute metadata_prefix.
Instance Method Summary collapse
- #dup ⇒ Object
- #get(label) ⇒ Object
-
#initialize(metadata = {}, metadata_prefix: self.class.metadata_prefix) ⇒ Metadata
constructor
A new instance of Metadata.
- #label_for(label) ⇒ Object
- #set(label:, value:) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(metadata = {}, metadata_prefix: self.class.metadata_prefix) ⇒ Metadata
Returns a new instance of Metadata.
13 14 15 16 |
# File 'lib/fluent/plugin/elasticsearch_stats/metadata.rb', line 13 def initialize( = {}, metadata_prefix: self.class.) @metadata = {}.update() @metadata_prefix = end |
Class Attribute Details
.metadata_prefix ⇒ Object
Returns the value of attribute metadata_prefix.
8 9 10 |
# File 'lib/fluent/plugin/elasticsearch_stats/metadata.rb', line 8 def @metadata_prefix end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
11 12 13 |
# File 'lib/fluent/plugin/elasticsearch_stats/metadata.rb', line 11 def @metadata end |
#metadata_prefix ⇒ Object (readonly)
Returns the value of attribute metadata_prefix.
11 12 13 |
# File 'lib/fluent/plugin/elasticsearch_stats/metadata.rb', line 11 def @metadata_prefix end |
Instance Method Details
#dup ⇒ Object
30 31 32 33 34 35 |
# File 'lib/fluent/plugin/elasticsearch_stats/metadata.rb', line 30 def dup self.class.new( .clone, metadata_prefix: .clone ) end |
#get(label) ⇒ Object
26 27 28 |
# File 'lib/fluent/plugin/elasticsearch_stats/metadata.rb', line 26 def get(label) [label_for(label)] end |
#label_for(label) ⇒ Object
37 38 39 |
# File 'lib/fluent/plugin/elasticsearch_stats/metadata.rb', line 37 def label_for(label) "#{}#{label}" end |
#set(label:, value:) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/fluent/plugin/elasticsearch_stats/metadata.rb', line 18 def set(label:, value:) return self if label.nil? || label.to_s.empty? @metadata[label_for(label)] = value self end |
#to_h ⇒ Object
41 42 43 |
# File 'lib/fluent/plugin/elasticsearch_stats/metadata.rb', line 41 def to_h .clone end |