Module: MoulinRouge
- Defined in:
- lib/moulin_rouge.rb,
lib/moulin_rouge/engine.rb,
lib/moulin_rouge/ability.rb,
lib/moulin_rouge/version.rb,
lib/moulin_rouge/model_double.rb,
lib/moulin_rouge/authorization.rb,
lib/moulin_rouge/cancan/method.rb,
lib/moulin_rouge/configuration.rb,
lib/moulin_rouge/cancan/ability.rb,
lib/moulin_rouge/cancan/responder.rb,
lib/generators/moulin_rouge/auth_generator.rb,
lib/generators/moulin_rouge/install_generator.rb
Defined Under Namespace
Modules: CanCan, Generators Classes: Ability, Authorization, Configuration, Engine, ModelDouble, RoleNotFound
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
-
.configuration ⇒ Object
Returns the global Configuration object.
-
.configure {|configuration| ... } ⇒ Object
Yields the global configuration to a block.
-
.load! ⇒ Object
Import all permission files in the configuration.
-
.reload! ⇒ Object
Reset all permission and load them again.
-
.reset! ⇒ Object
Reset all constants.
-
.run! ⇒ Object
Create the main permission, import all permission files and define the Ability class require for CanCan.
-
.run? ⇒ Boolean
Returns true if the run! method was called and false oterwise.
Class Method Details
.configuration ⇒ Object
Returns the global Configuration object.
5 6 7 |
# File 'lib/moulin_rouge.rb', line 5 def self.configuration @configuration ||= MoulinRouge::Configuration.new end |
.configure {|configuration| ... } ⇒ Object
Yields the global configuration to a block.
10 11 12 |
# File 'lib/moulin_rouge.rb', line 10 def self.configure yield configuration if block_given? end |
.load! ⇒ Object
Import all permission files in the configuration
25 26 27 |
# File 'lib/moulin_rouge.rb', line 25 def self.load! MoulinRouge::Authorization.compile! end |
.reload! ⇒ Object
Reset all permission and load them again
35 36 37 38 |
# File 'lib/moulin_rouge.rb', line 35 def self.reload! reset! load! end |
.reset! ⇒ Object
Reset all constants
41 42 43 |
# File 'lib/moulin_rouge.rb', line 41 def self.reset! #:nodoc: MoulinRouge::Authorization.reset! end |
.run! ⇒ Object
Create the main permission, import all permission files and define the Ability class require for CanCan
16 17 18 19 20 21 22 |
# File 'lib/moulin_rouge.rb', line 16 def self.run! self.load! # Create the ability class Object.const_set 'Ability', Class.new(MoulinRouge::CanCan::Ability) unless Object.const_defined? 'Ability' # Change flag @@run = true end |
.run? ⇒ Boolean
Returns true if the run! method was called and false oterwise
30 31 32 |
# File 'lib/moulin_rouge.rb', line 30 def self.run? @@run ||= false end |