Class: Dial::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/dial/configuration.rb

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dial/configuration.rb', line 13

def initialize
  @options = {
    enabled: true,
    force_param: FORCE_PARAM,
    sampling_percentage: ::Rails.env.development? ? SAMPLING_PERCENTAGE_DEV : SAMPLING_PERCENTAGE_PROD,
    storage: Storage::FileAdapter,
    storage_options: { ttl: STORAGE_TTL },
    content_security_policy_nonce: -> env, _headers { env[NONCE] || EMPTY_NONCE },
    toggle_shortcut_keys: TOGGLE_SHORTCUT_KEYS,
    vernier_interval: VERNIER_INTERVAL,
    vernier_allocation_interval: VERNIER_ALLOCATION_INTERVAL,
    prosopite_ignore_queries: PROSOPITE_IGNORE_QUERIES,
  }

  @options.keys.each do |key|
    define_singleton_method key do
      @options[key]
    end

    define_singleton_method "#{key}=" do |value|
      @options[key] = value
    end
  end
end

Instance Method Details

#freezeObject



38
39
40
41
42
# File 'lib/dial/configuration.rb', line 38

def freeze
  @options.freeze

  super
end