Sha256: a3048660e62566587e0346b33fd12f1c69c3e91a857c11d5ddf8d3c60bab593d

Contents?: true

Size: 1.27 KB

Versions: 8

Compression:

Stored size: 1.27 KB

Contents

module Mobility
=begin

Stores shared Mobility configuration referenced by all backends.

=end
  class Configuration
    # Alias for mobility_accessor (defaults to +translates+)
    # @return [Symbol]
    attr_accessor :accessor_method

    # Name of query scope/dataset method (defaults to +i18n+)
    # @return [Symbol]
    attr_accessor :query_method

    # Default fallbacks instance
    # @return [I18n::Locale::Fallbacks]
    def default_fallbacks(fallbacks = {})
      @default_fallbacks.call(fallbacks)
    end
    attr_writer :default_fallbacks

    # Default backend to use (can be symbol or actual backend class)
    # @return [Symbol,Class]
    attr_accessor :default_backend

    # Returns set of default accessor locles to use (defaults to
    # +I18n.available_locales+)
    # @return [Array<Symbol>]
    def default_accessor_locales
      if @default_accessor_locales.is_a?(Proc)
        @default_accessor_locales.call
      else
        @default_accessor_locales
      end
    end
    attr_writer :default_accessor_locales

    def initialize
      @accessor_method = :translates
      @query_method = :i18n
      @default_fallbacks = lambda { |fallbacks| I18n::Locale::Fallbacks.new(fallbacks) }
      @default_accessor_locales = lambda { I18n.available_locales }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mobility-0.1.20 lib/mobility/configuration.rb
mobility-0.1.19 lib/mobility/configuration.rb
mobility-0.1.18 lib/mobility/configuration.rb
mobility-0.1.17 lib/mobility/configuration.rb
mobility-0.1.16 lib/mobility/configuration.rb
mobility-0.1.15 lib/mobility/configuration.rb
mobility-0.1.14 lib/mobility/configuration.rb
mobility-0.1.13 lib/mobility/configuration.rb