Class: Upkeep::Rails::Configuration

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

Constant Summary collapse

SUBSCRIPTION_STORES =
[:active_record, :memory].freeze
REFUSED_BOUNDARY_BEHAVIORS =
[:raise, :warn].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



14
15
16
17
18
# File 'lib/upkeep/rails/configuration.rb', line 14

def initialize
  @enabled = true
  @subscription_store = :active_record
  @refused_boundary_behavior = nil
end

Instance Attribute Details

#enabledObject

Returns the value of attribute enabled.



11
12
13
# File 'lib/upkeep/rails/configuration.rb', line 11

def enabled
  @enabled
end

#subscription_storeObject

Returns the value of attribute subscription_store.



12
13
14
# File 'lib/upkeep/rails/configuration.rb', line 12

def subscription_store
  @subscription_store
end

Instance Method Details

#refused_boundary_behaviorObject



31
32
33
# File 'lib/upkeep/rails/configuration.rb', line 31

def refused_boundary_behavior
  @refused_boundary_behavior || default_refused_boundary_behavior
end

#refused_boundary_behavior=(value) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/upkeep/rails/configuration.rb', line 35

def refused_boundary_behavior=(value)
  value = value.to_sym if value.respond_to?(:to_sym)

  unless REFUSED_BOUNDARY_BEHAVIORS.include?(value)
    raise ConfigurationError,
      "Unknown Upkeep refused_boundary_behavior #{value.inspect}; expected one of #{REFUSED_BOUNDARY_BEHAVIORS.join(", ")}"
  end

  @refused_boundary_behavior = value
end