Module: Canard
- Defined in:
- lib/canard.rb,
lib/canard/railtie.rb,
lib/canard/version.rb,
lib/canard/user_model.rb,
lib/canard/find_abilities.rb,
lib/generators/canard/ability/ability_generator.rb
Defined Under Namespace
Modules: Generators, UserModel Classes: Railtie
Constant Summary collapse
- VERSION =
"0.1.0"
Class Attribute Summary collapse
-
.abilities_path ⇒ Object
A string specifying the location that should be searched for ability definitions.
Class Method Summary collapse
- .abilities_for(role, &block) ⇒ Object
- .ability_definitions ⇒ Object
-
.find_abilities ⇒ Object
:nodoc:.
Class Attribute Details
.abilities_path ⇒ Object
A string specifying the location that should be searched for ability definitions. By default, Canard will attempt to load abilities from Rails.root + /abilities/.
7 8 9 |
# File 'lib/canard/find_abilities.rb', line 7 def abilities_path @abilities_path end |
Class Method Details
.abilities_for(role, &block) ⇒ Object
13 14 15 |
# File 'lib/canard/find_abilities.rb', line 13 def abilities_for(role, &block) ability_definitions[role] = block end |
.ability_definitions ⇒ Object
9 10 11 |
# File 'lib/canard/find_abilities.rb', line 9 def ability_definitions @ability_definitions ||= {} end |
.find_abilities ⇒ Object
:nodoc:
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/canard/find_abilities.rb', line 19 def self.find_abilities #:nodoc: absolute_abilities_path = File.(abilities_path) if File.directory? absolute_abilities_path Dir[File.join(absolute_abilities_path, '**', '*.rb')].sort.each do |file| self.class_eval File.read(file) end end end |