Sha256: c73c4cedb750301290c99606c5273d4190291a69665a79f4013bdb4ac75b3054

Contents?: true

Size: 888 Bytes

Versions: 13

Compression:

Stored size: 888 Bytes

Contents

module Spree
  module Tax
    # Singleton class to access the tax configuration object (TaxConfiguration.first by default) and it's preferences.
    #
    # Usage:
    #   Spree::Tax::Config[:foo]                  # Returns the foo preference
    #   Spree::Tax::Config[]                      # Returns a Hash with all the tax preferences
    #   Spree::Tax::Config.instance               # Returns the configuration object (TaxConfiguration.first)
    #   Spree::Tax::Config.set(preferences_hash)  # Set the tax preferences as especified in +preference_hash+
    class Config
      include Singleton
      include PreferenceAccess
    
      class << self
        def instance
          return nil unless ActiveRecord::Base.connection.tables.include?('configurations')
          TaxConfiguration.find_or_create_by_name("Default tax configuration")
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
spree-0.8.4 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.8.5 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.4.0 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.4.1 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.5.0 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.6.0 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.5.1 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.7.0 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.7.1 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.8.0 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.8.1 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.8.2 vendor/extensions/tax_calculator/lib/spree/tax/config.rb
spree-0.8.3 vendor/extensions/tax_calculator/lib/spree/tax/config.rb