module ElasticAPM::Fields

An interface for creating simple, value holding objects that correspond to object fields in the API.

Example:

class MyThing
  include Fields
  field :name
  field :address, optional: true
end

MyThing.new(name: 'AJ').to_h
  # => { name: 'AJ' }
MyThing.new().empty?
  # => true

Public Class Methods

included(cls) click to toggle source
# File lib/elastic_apm/fields.rb, line 80
def self.included(cls)
  cls.extend(ClassMethods)
  cls.include(InstanceMethods)

  cls.instance_variable_set(:@fields, [])
  cls.instance_variable_set(:@optionals, [])
end