Class: LogStruct::ConfigStruct::FilterMatcher

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/log_struct/config_struct/filters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callable:, label:, matches_logstruct_fields: true) ⇒ void

Parameters:

  • callable (T.proc.params(key: String, value: T.untyped).returns(T::Boolean))
  • label (String)
  • matches_logstruct_fields (Boolean) (defaults to: true) —

    Whether the matcher also applies to the names of LogStruct's own fields at the top of a line. LogStruct's matcher for Rails' partial matches doesn't: Rails' default :_key would filter cron_key.



# File ''

const :callable, T.proc.params(key: String, value: T.untyped).returns(T::Boolean)
const :label, String
const :matches_logstruct_fields, T::Boolean, default: true

Instance Attribute Details

#callable ⇒ T.proc.params(key: String, value: T.untyped).returns(T::Boolean) (readonly)

Returns the value of prop callable.

Returns:

  • (T.proc.params(key: String, value: T.untyped).returns(T::Boolean))


# File ''

const :callable, T.proc.params(key: String, value: T.untyped).returns(T::Boolean)

#label ⇒ String (readonly)

Returns the value of prop label.

Returns:

  • (String)


# File ''

const :label, String

#matches_logstruct_fields ⇒ Boolean (readonly)

Whether the matcher also applies to the names of LogStruct's own fields at the top of a line. LogStruct's matcher for Rails' partial matches doesn't: Rails' default :_key would filter cron_key.

Returns:

  • (Boolean)


# File ''

const :matches_logstruct_fields, T::Boolean, default: true

Instance Method Details

#matches?(key, value) ⇒ Boolean

Parameters:

  • key (String)
  • value (T.untyped)

Returns:

  • (Boolean)


33
34
35
# File 'lib/log_struct/config_struct/filters.rb', line 33

def matches?(key, value)
  callable.call(key, value)
end