lib/rails/auth/acl/resource.rb in rails-auth-0.2.0 vs lib/rails/auth/acl/resource.rb in rails-auth-0.3.0
- old
+ new
@@ -16,15 +16,15 @@
# @option :options [String] :method HTTP method allowed ("ALL" for all methods)
# @option :options [String] :path path to the resource (regex syntax allowed)
# @param [Hash] :predicates matchers for this resource
#
def initialize(options, predicates)
- fail TypeError, "expected Hash for options" unless options.is_a?(Hash)
- fail TypeError, "expected Hash for predicates" unless predicates.is_a?(Hash)
+ raise TypeError, "expected Hash for options" unless options.is_a?(Hash)
+ raise TypeError, "expected Hash for predicates" unless predicates.is_a?(Hash)
unless (extra_keys = options.keys - VALID_OPTIONS).empty?
- fail ParseError, "unrecognized key in ACL resource: #{extra_keys.first}"
+ raise ParseError, "unrecognized key in ACL resource: #{extra_keys.first}"
end
@http_methods = extract_methods(options["method"])
@path = /\A#{options.fetch("path")}\z/
@predicates = predicates.freeze
@@ -61,10 +61,10 @@
methods = Array(methods)
return nil if methods.include?("ALL")
methods.each do |method|
- fail ParseError, "invalid HTTP method: #{method}" unless HTTP_METHODS.include?(method)
+ raise ParseError, "invalid HTTP method: #{method}" unless HTTP_METHODS.include?(method)
end
methods.freeze
end
end