Sha256: e7be089aeaeb59eeeb20bb8a9f1e77b636ae2402d7e085b6789fbf436bac930f
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
module Canard class << self # A string specifying the location that should be searched for ability # definitions. By default, Canard will attempt to load abilities from # Rails.root + /abilities/. attr_writer :abilities_path def abilities_path @abilities_path ||= File.expand_path('abilities', Rails.root) end def ability_definitions Abilities.definitions end def abilities_for(role, &block) ::ActiveSupport::Deprecation.warn("abilities_for is deprecated and will be removed from Canard 0.4.0. Use Canard::Abilities.for and move the definitions to app/abilities.") ability_definitions[role] = block end end def self.find_abilities #:nodoc: absolute_abilities_path = File.expand_path(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 Abilities.definition_paths.each do |path| Dir[File.join(Rails.root, path, '**', '*.rb')].sort.each do |file| load file end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
canard-0.3.4 | lib/canard/find_abilities.rb |
canard-0.3.2 | lib/canard/find_abilities.rb |
canard-0.3.1 | lib/canard/find_abilities.rb |