Class: Clerk::Configuration
- Inherits:
-
Object
- Object
- Clerk::Configuration
- Defined in:
- lib/clerk/configuration.rb
Instance Attribute Summary collapse
-
#cache_store ⇒ Object
Returns the value of attribute cache_store.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#excluded_routes ⇒ Object
Returns the value of attribute excluded_routes.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#publishable_key ⇒ Object
Returns the value of attribute publishable_key.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #update(options) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/clerk/configuration.rb', line 14 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 ClerkHttpClient.configure do |config| unless secret_key.nil? || secret_key.empty? config.access_token = @secret_key end end end |
Instance Attribute Details
#cache_store ⇒ Object
Returns the value of attribute cache_store.
7 8 9 |
# File 'lib/clerk/configuration.rb', line 7 def cache_store @cache_store end |
#debug ⇒ Object
Returns the value of attribute debug.
8 9 10 |
# File 'lib/clerk/configuration.rb', line 8 def debug @debug end |
#excluded_routes ⇒ Object
Returns the value of attribute excluded_routes.
10 11 12 |
# File 'lib/clerk/configuration.rb', line 10 def excluded_routes @excluded_routes end |
#logger ⇒ Object
Returns the value of attribute logger.
9 10 11 |
# File 'lib/clerk/configuration.rb', line 9 def logger @logger end |
#publishable_key ⇒ Object
Returns the value of attribute publishable_key.
11 12 13 |
# File 'lib/clerk/configuration.rb', line 11 def publishable_key @publishable_key end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
12 13 14 |
# File 'lib/clerk/configuration.rb', line 12 def secret_key @secret_key end |
Class Method Details
.default ⇒ Object
33 34 35 |
# File 'lib/clerk/configuration.rb', line 33 def self.default @@default ||= new end |
Instance Method Details
#update(options) ⇒ Object
37 38 39 40 41 |
# File 'lib/clerk/configuration.rb', line 37 def update() .each do |key, value| send(:"#{key}=", value) end end |