lib/canard/abilities.rb in canard-0.5.0.pre vs lib/canard/abilities.rb in canard-0.6.0.pre
- old
+ new
@@ -1,13 +1,13 @@
+# frozen_string_literal: true
+
module Canard
- class Abilities
+ class Abilities # :nodoc:
+ @definitions = {}
+ @default_path = 'app/abilities'
- @definitions = {}
- @default_path = 'app/abilities'
-
class << self
-
extend Forwardable
def_delegators :Canard, :ability_key
attr_accessor :default_path
@@ -19,15 +19,13 @@
def definition_paths
@definition_paths ||= [@default_path]
end
def for(name, &block)
- raise ArgumentError.new('No block of ability definitions given') unless block_given?
+ raise ArgumentError, 'No block of ability definitions given' unless block_given?
+
key = ability_key(name)
@definitions[key] = block
end
-
end
-
end
-
end