lib/card/codename.rb in card-1.17.4 vs lib/card/codename.rb in card-1.18.0
- old
+ new
@@ -41,11 +41,11 @@
end
end
def check_duplicates codehash, codename, card_id
# FIXME: remove duplicate checks here; should be caught upon creation
- return unless codehash.has_key?(codename) || codehash.has_key?(card_id)
+ return unless codehash.key?(codename) || codehash.key?(card_id)
warn "dup code ID:#{card_id} (#{codehash[codename]}), " \
"CD:#{codename} (#{codehash[card_id]})"
end
def load_hash
@@ -61,10 +61,11 @@
end
end
end
def self.const_missing const
- if const.to_s =~ /^([A-Z]\S*)ID$/ && (code = $1.underscore.to_sym)
+ if const.to_s =~ /^([A-Z]\S*)ID$/ &&
+ (code = Regexp.last_match(1).underscore.to_sym)
if (card_id = Codename[code])
const_set const, card_id
else
raise "Missing codename #{code} (#{const})"
end