Sha256: ad1d4319880e94a7e97f4b116e9cd91a5b350e5039a54c52729e4ce95f97986c

Contents?: true

Size: 804 Bytes

Versions: 1

Compression:

Stored size: 804 Bytes

Contents

require 'cavy/engine'
require 'cavy/railtie' if defined?(Rails)
require 'cavy/uploaders/file_uploader'
require 'cavy/js_web_token'

module Cavy
  mattr_accessor :title, :locales, :default_locale,
                 :raise_not_found_error, :at_least_one_user, :uploader

  self.title = 'cavy'

  self.locales = [:en]
  self.default_locale = :en
  self.raise_not_found_error = false
  self.at_least_one_user = false
  self.uploader = nil

  def self.config
    yield(self)
    set_locale
  end

  def self.is_first_time?
    return false if at_least_one_user
    self.at_least_one_user = Cavy::User.count != 0
    !at_least_one_user
  end

  private

  def self.set_locale
    I18n.available_locales = locales unless locales.nil?
    I18n.default_locale = default_locale unless default_locale.nil?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cavy-0.1.0.beta2 lib/cavy.rb