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

Version Path
backlog-0.3.5 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.3.7 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.3.8 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.3.9 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.0 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.4.0 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.1 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.2 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.10 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.3 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.4 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.6 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.5 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.7 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.9 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.5.8 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.6.0 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.6.1 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.6.2 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb
backlog-0.6.3 vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb