module ElasticAPM::Fields::InstanceMethods

Public Class Methods

new(**attrs) click to toggle source
Calls superclass method
# File lib/elastic_apm/fields.rb, line 46
def initialize(**attrs)
  schema.each do |key, field|
    send(:"#{key}=", field.default)
  end

  attrs.each do |key, value|
    send(:"#{key}=", value)
  end

  super()
end

Public Instance Methods

empty?() click to toggle source
# File lib/elastic_apm/fields.rb, line 58
def empty?
  self.class.schema.each do |key, field|
    next if send(key).nil?
    return false
  end

  true
end
to_h() click to toggle source
# File lib/elastic_apm/fields.rb, line 67
def to_h
  schema.each_with_object({}) do |(key, field), hsh|
    hsh[key] = send(key)
  end
end

Private Instance Methods

schema() click to toggle source
# File lib/elastic_apm/fields.rb, line 75
def schema
  self.class.schema
end