Sha256: 4fe96f4d0ef05270c0a4579312d6a384eaed29d536fab51b23b0b00e41213a6b

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

require "active_record"

require "feste/version"
require "feste/engine" if defined?(Rails)
require "feste/authentication/authentication"
require "feste/authentication/clearance"
require "feste/authentication/custom"
require "feste/authentication/devise"
require "feste/user"
require "feste/template_helper"
require "feste/mailer"

module Feste
  mattr_accessor :options

  def self.table_name_prefix
    "feste_"
  end

  self.options = {
    categories: [],
    host: nil,
    email_source: :email,
    authenticate_with: nil,
    callback_handler: nil
  }

  def self.configure
    begin
      yield(Config)
    rescue NoConfigurationError => e
      puts "FESTE CONFIGURATION WARNING: #{e}"
    end
  end

  module Config
    def self.method_missing(meth, *args, &block)
      key = meth.to_s.slice(0, meth.to_s.length - 1).to_sym
      if Feste.options.has_key?(key)
        Feste.options[key] = args[0]
      else
        raise(
          NoConfigurationError,
          "There is no configuration option for #{key}"
        )
      end
    end
  end

  class NoConfigurationError < StandardError
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
feste-0.4.2 lib/feste.rb
feste-0.4.1 lib/feste.rb
feste-0.4.0 lib/feste.rb
feste-0.3.0 lib/feste.rb