Class: Clerk::Configuration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/clerk/configuration.rb', line 15

def initialize
  @excluded_routes = []
  @publishable_key = ENV['CLERK_PUBLISHABLE_KEY']
  @secret_key = ENV['CLERK_SECRET_KEY']

  # Default to Rails.cache or ActiveSupport::Cache::MemoryStore, if available, otherwise nil
  @cache_store = if defined?(::Rails)
    ::Rails.cache
  elsif defined?(::ActiveSupport::Cache::MemoryStore)
    ::ActiveSupport::Cache::MemoryStore.new
  end
end

Instance Attribute Details

#cache_storeObject

Returns the value of attribute cache_store.



7
8
9
# File 'lib/clerk/configuration.rb', line 7

def cache_store
  @cache_store
end

#debugObject

Returns the value of attribute debug.



8
9
10
# File 'lib/clerk/configuration.rb', line 8

def debug
  @debug
end

#excluded_routesObject

Returns the value of attribute excluded_routes.



9
10
11
# File 'lib/clerk/configuration.rb', line 9

def excluded_routes
  @excluded_routes
end

#loggerObject

Returns the value of attribute logger.



13
14
15
# File 'lib/clerk/configuration.rb', line 13

def logger
  @logger
end

#publishable_keyObject

Returns the value of attribute publishable_key.



10
11
12
# File 'lib/clerk/configuration.rb', line 10

def publishable_key
  @publishable_key
end

#secret_keyObject

Returns the value of attribute secret_key.



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

def secret_key
  @secret_key
end

Class Method Details

.defaultObject



28
29
30
31
32
# File 'lib/clerk/configuration.rb', line 28

def self.default
  # rubocop:disable Style/ClassVars
  @@default ||= new
  # rubocop:enable Style/ClassVars
end

Instance Method Details

#update(options) ⇒ Object



34
35
36
37
38
# File 'lib/clerk/configuration.rb', line 34

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