Class: Datadog::Statsd::Schema::SchemaBuilder::TransformerBuilder Private

Inherits:
Object
  • Object
show all
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 transformers within the DSL

Since:

  • 0.1.0

API:

  • private

Instance Method Summary collapse

Constructor Details

#initialize(transformers) ⇒ TransformerBuilder

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 with the transformers hash

Parameters:

  • Hash to store transformer definitions

Since:

  • 0.1.0

API:

  • private



93
94
95
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 93

def initialize(transformers)
  @transformers = transformers
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, proc = nil) {|Object| ... } ⇒ 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.

Dynamic method to define transformers

Parameters:

  • Name of the transformer

  • (defaults to: nil)

    Transformer procedure (alternative to block)

Yields:

  • (Object)

    Value to transform

Since:

  • 0.1.0

API:

  • private



102
103
104
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 102

def method_missing(name, proc = nil, &block)
  @transformers[name.to_sym] = proc || block
end

Instance Method Details

#respond_to_missing?(_name, _include_private = false) ⇒ Boolean

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.

Always respond to any method for transformer definition

Parameters:

  • Method name

  • (defaults to: false)

    Whether to include private methods

Returns:

  • Always true

Since:

  • 0.1.0

API:

  • private



110
111
112
# File 'lib/datadog/statsd/schema/schema_builder.rb', line 110

def respond_to_missing?(_name, _include_private = false)
  true
end