Class: Datadog::Statsd::Schema::SchemaBuilder::NamespaceBuilder Private
- Inherits:
-
Object
- Object
- Datadog::Statsd::Schema::SchemaBuilder::NamespaceBuilder
- Defined in:
- lib/datadog/statsd/schema/schema_builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Helper class for building namespaces within the DSL
Instance Attribute Summary collapse
-
#description(desc) ⇒ void
readonly
private
Set description for this namespace.
-
#metrics {|MetricsBuilder| ... } ⇒ void
readonly
private
Define metrics for this namespace.
-
#name ⇒ Symbol
readonly
private
Name of the namespace being built.
-
#namespaces ⇒ Hash<Symbol, Namespace>
readonly
private
Nested namespaces.
-
#tags {|TagsBuilder| ... } ⇒ void
readonly
private
Define tags for this namespace.
-
#transformers ⇒ Hash<Symbol, Proc>
readonly
private
Available transformers for tags.
Instance Method Summary collapse
-
#build ⇒ Namespace
private
Build the namespace instance.
-
#initialize(name, transformers = {}) ⇒ NamespaceBuilder
constructor
private
Initialize a new namespace builder.
-
#namespace(name) {|NamespaceBuilder| ... } ⇒ void
private
Define nested namespace.
Constructor Details
#initialize(name, transformers = {}) ⇒ NamespaceBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a new namespace builder
145 146 147 148 149 150 151 152 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 145 def initialize(name, transformers = {}) @name = name.to_sym @transformers = transformers = {} @metrics = {} @namespaces = {} @description = nil end |
Instance Attribute Details
#description(desc) ⇒ void (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Set description for this namespace
140 141 142 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 140 def description @description end |
#metrics {|MetricsBuilder| ... } ⇒ void (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Define metrics for this namespace
132 133 134 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 132 def metrics @metrics end |
#name ⇒ Symbol (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Name of the namespace being built
120 121 122 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 120 def name @name end |
#namespaces ⇒ Hash<Symbol, Namespace> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Nested namespaces
136 137 138 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 136 def namespaces @namespaces end |
#tags {|TagsBuilder| ... } ⇒ void (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Define tags for this namespace
128 129 130 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 128 def end |
#transformers ⇒ Hash<Symbol, Proc> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Available transformers for tags
124 125 126 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 124 def transformers @transformers end |
Instance Method Details
#build ⇒ Namespace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build the namespace instance
197 198 199 200 201 202 203 204 205 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 197 def build Namespace.new( name: @name, description: @description, tags: , metrics: @metrics, namespaces: @namespaces ) end |
#namespace(name) {|NamespaceBuilder| ... } ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Define nested namespace
189 190 191 192 193 |
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 189 def namespace(name, &) builder = NamespaceBuilder.new(name, @transformers) builder.instance_eval(&) if block_given? @namespaces[name.to_sym] = builder.build end |