Froze rails gems
[depot.git] / vendor / rails / activesupport / lib / active_support / core_ext / name_error.rb
1 # Add a +missing_name+ method to NameError instances.
2 class NameError #:nodoc:
3 # Add a method to obtain the missing name from a NameError.
4 def missing_name
5 $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message
6 end
7
8 # Was this exception raised because the given name was missing?
9 def missing_name?(name)
10 if name.is_a? Symbol
11 last_name = (missing_name || '').split('::').last
12 last_name == name.to_s
13 else
14 missing_name == name.to_s
15 end
16 end
17 end