Sha256: 6e827ef2a347adb8d9132dd7775010ce42cf8e47a4949f7dbb54442138baefd8
Contents?: true
Size: 1.16 KB
Versions: 4
Compression:
Stored size: 1.16 KB
Contents
require 'clarion/stores' require 'clarion/counters' module Clarion class Config class << self def option(meth) options << meth end def options @options ||= [] end end def initialize(options={}) @options = options # Validation self.class.options.each do |m| send(m) end end attr_reader :options option def registration_allowed_url @options.fetch(:registration_allowed_url) end option def authn_default_expires_in @options.fetch(:authn_default_expires_in, 300).to_i end option def app_id @options[:app_id] end option def store @store ||= Clarion::Stores.find(@options.fetch(:store).fetch(:kind)).new(store_options) end def store_options @store_options ||= @options.fetch(:store).dup.tap { |_| _.delete(:kind) } end option def counter if @options[:counter] @counter ||= Clarion::Counters.find(@options.fetch(:counter).fetch(:kind)).new(counter_options) end end def counter_options @counter_options ||= @options.fetch(:counter).dup.tap { |_| _.delete(:kind) } end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
clarion-0.3.0 | lib/clarion/config.rb |
clarion-0.2.1 | lib/clarion/config.rb |
clarion-0.2.0 | lib/clarion/config.rb |
clarion-0.1.0 | lib/clarion/config.rb |