Class: LogStruct::ConfigStruct::LazyRoot

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

Overview

The root a PathFilterMatcher gets, built the first time a matcher reads it

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ void

Parameters:

  • value (T.untyped)


62
63
64
65
66
# File 'lib/log_struct/config_struct/filters.rb', line 62

def initialize(value)
  @source = value
  @built = T.let(false, T::Boolean)
  @value = T.let(nil, T.untyped)
end

Instance Method Details

#value ⇒ T.untyped

The value with indifferent access, as Rails gives filter blocks the request's parameters

Returns:

  • (T.untyped)


70
71
72
73
74
75
76
77
78
79
# File 'lib/log_struct/config_struct/filters.rb', line 70

def value
  return @value if @built

  @built = true
  @value = begin
    @source.is_a?(Hash) ? ActiveSupport::HashWithIndifferentAccess.new(@source) : @source
  rescue SystemStackError, StandardError
    @source
  end
end