lib/rails/auth/acl.rb in rails-auth-0.2.0 vs lib/rails/auth/acl.rb in rails-auth-0.3.0
- old
+ new
@@ -24,11 +24,11 @@
def initialize(acl, matchers: {})
@resources = []
acl.each_with_index do |entry|
resources = entry["resources"]
- fail ParseError, "no 'resources' key present in entry: #{entry.inspect}" unless resources
+ raise ParseError, "no 'resources' key present in entry: #{entry.inspect}" unless resources
predicates = parse_predicates(entry, matchers.merge(DEFAULT_MATCHERS))
resources.each do |resource|
@resources << Resource.new(resource, predicates).freeze
@@ -71,11 +71,11 @@
entry.each do |name, options|
next if name == "resources"
matcher_class = matchers[name.to_sym]
- fail ArgumentError, "no matcher for #{name}" unless matcher_class
- fail TypeError, "expected Class for #{name}" unless matcher_class.is_a?(Class)
+ raise ArgumentError, "no matcher for #{name}" unless matcher_class
+ raise TypeError, "expected Class for #{name}" unless matcher_class.is_a?(Class)
predicates[name.freeze] = matcher_class.new(options.freeze).freeze
end
predicates.freeze