Sha256: 37dcf41d2a7b7ac4024640ce4af720bd41dd8a1bc6670efd8600c80880cf4e85
Contents?: true
Size: 502 Bytes
Versions: 67
Compression:
Stored size: 502 Bytes
Contents
# Add a +missing_name+ method to NameError instances. class NameError < StandardError #:nodoc: # Add a method to obtain the missing name from a NameError. def missing_name $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message end # Was this exception raised because the given name was missing? def missing_name?(name) if name.is_a? Symbol last_name = (missing_name || '').split('::').last last_name == name.to_s else missing_name == name.to_s end end end
Version data entries
67 entries across 67 versions & 4 rubygems