lib/gem_config/rules.rb in gem_config-0.2.3 vs lib/gem_config/rules.rb in gem_config-0.2.4
- old
+ new
@@ -1,7 +1,5 @@
-require 'active_support/core_ext/hash/keys'
-
module GemConfig
class Rules < Hash
InvalidKeyError = Class.new(StandardError)
def has(key, attrs = {})
@@ -22,10 +20,13 @@
end
private
def check_attributes(attrs)
- attrs.assert_valid_keys :classes, :values, :default
+ allowed_keys = [:classes, :values, :default]
+ attrs.keys.each do |k|
+ raise ArgumentError, %("#{k}" is not a valid attribute. Valid attributes are: #{allowed_keys.join(', ')}) unless allowed_keys.include?(k)
+ end
if attrs.has_key?(:classes)
other_than_class = Array(attrs[:classes]).any? do |value|
!value.is_a?(Class)
end