Class: CanTango::Configuration
- Inherits:
-
Object
- Object
- CanTango::Configuration
show all
- Includes:
- Singleton
- Defined in:
- lib/cantango/configuration.rb,
lib/cantango/configuration/orms.rb,
lib/cantango/configuration/user.rb,
lib/cantango/configuration/debug.rb,
lib/cantango/configuration/guest.rb,
lib/cantango/configuration/hooks.rb,
lib/cantango/configuration/modes.rb,
lib/cantango/configuration/users.rb,
lib/cantango/configuration/engine.rb,
lib/cantango/configuration/models.rb,
lib/cantango/configuration/ability.rb,
lib/cantango/configuration/account.rb,
lib/cantango/configuration/engines.rb,
lib/cantango/configuration/factory.rb,
lib/cantango/configuration/accounts.rb,
lib/cantango/configuration/adapters.rb,
lib/cantango/configuration/autoload.rb,
lib/cantango/configuration/category.rb,
lib/cantango/configuration/registry.rb,
lib/cantango/configuration/categories.rb,
lib/cantango/configuration/localhosts.rb,
lib/cantango/configuration/models/mongo.rb,
lib/cantango/configuration/registry/base.rb,
lib/cantango/configuration/registry/hash.rb,
lib/cantango/configuration/models/actions.rb,
lib/cantango/configuration/models/generic.rb,
lib/cantango/configuration/models/mongoid.rb,
lib/cantango/configuration/registry/clazz.rb,
lib/cantango/configuration/execution_modes.rb,
lib/cantango/configuration/models/data_mapper.rb,
lib/cantango/configuration/models/mongo_mapper.rb,
lib/cantango/configuration/models/active_record.rb
Defined Under Namespace
Modules: ExecutionModes, Factory, Registry
Classes: Ability, Account, Accounts, Adapters, Autoload, Categories, Category, Debug, Engine, Engines, Guest, Hooks, Localhosts, Models, Modes, Orms, User, Users
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.components ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/cantango/configuration.rb', line 33
def self.components
[
:guest, :autoload, :user, :account, :models, :modes, :roles, :role_groups,
:engines, :users, :accounts, :categories, :adapters, :debug,
:localhosts, :orms, :hooks
]
end
|
Instance Method Details
#ability ⇒ Object
27
28
29
30
31
|
# File 'lib/cantango/configuration.rb', line 27
def ability
@ability ||= conf::Ability.instance
@ability.default_class ||= CanTango::Ability::Executor::Modal @ability
end
|
#clear! ⇒ Object
72
73
74
75
76
77
78
79
80
|
# File 'lib/cantango/configuration.rb', line 72
def clear!
CanTango::Configuration.components.each do |component|
if respond_to? component
component = send(component)
component.send(:clear!) if component.respond_to? :clear!
end
end
engines.clear!
end
|
#debug! ⇒ Object
51
52
53
|
# File 'lib/cantango/configuration.rb', line 51
def debug!
debug.set :on
end
|
#enable_defaults! ⇒ Object
Turn on default engines and enable compile adapter i.e compilation of rules via sourcify
57
58
59
60
|
# File 'lib/cantango/configuration.rb', line 57
def enable_defaults!
engines.all :off
adapters.use :compiler
end
|
#enable_helpers(*names) ⇒ Object
62
63
64
65
|
# File 'lib/cantango/configuration.rb', line 62
def enable_helpers *names
names = names.to_symbols
enable_rest_helper if names.include? :rest
end
|
#enable_rest_helper ⇒ Object
67
68
69
70
|
# File 'lib/cantango/configuration.rb', line 67
def enable_rest_helper
raise 'ApplicationController not defined' if !defined?(::ApplicationController)
::ApplicationController.send :include, CanTango::Rails::Helpers::RestHelper
end
|
#engine(name) {|engine| ... } ⇒ Object
allow either block or direct access engine(:permission) do |permission| engine(:permission).config_path
92
93
94
95
96
|
# File 'lib/cantango/configuration.rb', line 92
def engine name, &block
engine = find_engine(name)
yield engine if block
engine
end
|
#include_models(*names) ⇒ Object
82
83
84
85
86
87
|
# File 'lib/cantango/configuration.rb', line 82
def include_models *names
names = names.select_symbols
if names.include? :default_guest_user
require 'cantango/user/guest'
end
end
|