Sha256: af06862dab75c812fa7d99833ffa7f1a286cccea2283a0d6ae5c0bc73186306a

Contents?: true

Size: 931 Bytes

Versions: 4

Compression:

Stored size: 931 Bytes

Contents

module VinExploder
  
  class Configuration
    
    attr_accessor :cache_options, :adapter_options
    
    def initialize
      @cache_store = nil
      @cache_options = {}
      @adapter = nil
      @adapter_options = {}
    end
    
    def cache_store(*args)
      if args.empty?
        case @cache_store
        when Symbol
          VinExploder::Cache.const_get(@cache_store.to_s.split('_').map{|s| s.capitalize }.join)
        else
          @cache_store
        end
      else
        @cache_store = args.shift
        @cache_options = args.shift || {}
      end
    end
    
    def adapter(*args)
      if args.empty?
        case @adapter
        when Symbol
          VinExploder::Decode.const_get(@adapter.to_s.split('_').map{|s| s.capitalize }.join)
        else
          @adapter
        end
      else
        @adapter = args.shift
        @adapter_options = args.shift || {}
      end
    end
    
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vin_exploder-0.3.1 lib/vin_exploder/configuration.rb
vin_exploder-0.3.0 lib/vin_exploder/configuration.rb
vin_exploder-0.2.0 lib/vin_exploder/configuration.rb
vin_exploder-0.1.0 lib/vin_exploder/configuration.rb