Sha256: a0a61a9f74743c3dd69161b95dda827083031f2298cd1eb34725b36471efb3da

Contents?: true

Size: 1.28 KB

Versions: 30

Compression:

Stored size: 1.28 KB

Contents

# -*- encoding : utf-8 -*-

require 'ext/all'
require 'colorize'

module Phrase
  autoload :Config, 'phrase/config'

  CLIENT_VERSION = "0.1"
  API_VERSION = "v1"

  class << self

    def config
      Thread.current[:phrase_config] ||= Phrase::Config.new
    end

    def config=(value)
      Thread.current[:phrase_config] = value
    end

    %w(enabled backend prefix suffix auth_token client_version js_host js_use_ssl cache_key_segments_initial cache_lifetime ignored_keys).each do |method|
      module_eval <<-DELEGATORS, __FILE__, __LINE__ + 1
        def #{method}
          config.#{method}
        end
      DELEGATORS

      module_eval <<-DELEGATORS, __FILE__, __LINE__ + 1
        def #{method}=(value)
          config.#{method} = (value)
        end
      DELEGATORS
    end

    def enabled?
      enabled
    end

    def disabled?
      !enabled
    end
  end

  def self.configure
    yield(self.config)
  end

  autoload :ViewHelpers, 'phrase/view_helpers'

  require 'phrase/api'
  require 'phrase/formats'
  require 'phrase/version'
  require 'phrase/engine'
  require 'phrase/backend'
  require 'phrase/delegate'
end

# Only load adapters directly if non-rails app, otherwise use engine
unless defined? Rails
  require 'phrase/adapters/i18n'
  require 'phrase/adapters/fast_gettext'
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
phrase-0.4.31 lib/phrase.rb
phrase-0.4.30 lib/phrase.rb
phrase-0.4.29 lib/phrase.rb
phrase-0.4.28 lib/phrase.rb
phrase-0.4.27 lib/phrase.rb
phrase-0.4.26 lib/phrase.rb
phrase-0.4.25 lib/phrase.rb
phrase-0.4.24 lib/phrase.rb
phrase-0.4.23 lib/phrase.rb
phrase-0.4.22 lib/phrase.rb
phrase-0.4.21 lib/phrase.rb
phrase-0.4.20 lib/phrase.rb
phrase-0.4.19 lib/phrase.rb
phrase-0.4.18 lib/phrase.rb
phrase-0.4.17 lib/phrase.rb
phrase-0.4.16 lib/phrase.rb
phrase-0.4.15 lib/phrase.rb
phrase-0.4.14 lib/phrase.rb
phrase-0.4.13 lib/phrase.rb
phrase-0.4.12 lib/phrase.rb