Sha256: 578fac8fe93d7fa0247030a2e16cd5d32ea4215aa6779895f50a84870cd4aa56

Contents?: true

Size: 731 Bytes

Versions: 12

Compression:

Stored size: 731 Bytes

Contents

require "detour/engine"
require "detour/acts_as_flaggable"
require "detour/flaggable"
require "detour/flag_form"
require "detour/configuration"

module Detour
  # Allows for configuration of Detour::Feature, mostly intended
  # for defining groups:
  #
  # @example
  #   Detour.configure do |config|
  #     config.define_user_group :admins do |user|
  #       user.admin?
  #     end
  #   end
  def self.configure(&block)
    ActionDispatch::Reloader.to_prepare do
      yield Detour.config
      Detour.config.flaggable_types.each { |f| f.constantize }
    end
  end

  def self.config
    @config ||= Detour::Configuration.new
  end
end

if defined?(ActiveRecord::Base)
  ActiveRecord::Base.extend Detour::ActsAsFlaggable
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
detour-0.0.15 lib/detour.rb
detour-0.0.14 lib/detour.rb
detour-0.0.13 lib/detour.rb
detour-0.0.12 lib/detour.rb
detour-0.0.11 lib/detour.rb
detour-0.0.10 lib/detour.rb
detour-0.0.9 lib/detour.rb
detour-0.0.7 lib/detour.rb
detour-0.0.6 lib/detour.rb
detour-0.0.5 lib/detour.rb
detour-0.0.3 lib/detour.rb
detour-0.0.2 lib/detour.rb