lib/dionysus/configuration.rb in dionysus-0.1.0 vs lib/dionysus/configuration.rb in dionysus-0.1.1

- old
+ new

@@ -139,11 +139,11 @@ # This is a hard key configuration set if # 1) the first argument is NOT false # 2) there are explicit keys defined # 3) there is a default set of arguments def _hard_keys?( defaults, args ) - if args.first == true or args.first == false + if [false, true].include?(args.first) args.shift else args.any? or (defaults and defaults.any?) end end @@ -151,11 +151,11 @@ ## # Normalize the keys and keys from the defaults hash into the hard keys # array. def _normalize_hard_keys( defaults, keys ) returning [] do |keys_| - (keys + defaults.keys).uniq.collect {|k| k.to_s}.sort.each do |key| + (keys + defaults.keys).uniq.collect {|key_| key_.to_s}.sort.each do |key| raise ArgumentError, "Invalid key: '#{key}'" unless valid_key?(key) keys_ << _normalize_key(key) end end.freeze end @@ -182,10 +182,10 @@ key, setter = _normalize_key(match[1]), (match[2] == '=') if allowed_key?(key) and !block_given? if setter and args.length == 1 return set(key, args.first) - elsif match[1] and match[2].nil? and args.length == 0 + elsif key and !setter and args.empty? return get(key) end end super end