Class: Test::Unit::Assertions::ThrowTagExtractor Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/test/unit/assertions.rb |
Constant Summary
-
UncaughtThrowPatterns =
# File 'lib/test/unit/assertions.rb', line 811{ NameError => /^uncaught throw `(.+)'$/, ArgumentError => /^uncaught throw (`.'|.)$/, ThreadError => /^uncaught throw `(.+)' in thread /, }
Class Method Summary
- .new(error) ⇒ ThrowTagExtractor constructor Internal use only
Instance Method Summary
- #extract_tag Internal use only
- #normalize_tag(tag) private Internal use only
Constructor Details
.new(error) ⇒ ThrowTagExtractor
# File 'lib/test/unit/assertions.rb', line 817
def initialize(error) @error = error end
Instance Method Details
#extract_tag
[ GitHub ]# File 'lib/test/unit/assertions.rb', line 821
def extract_tag tag = nil if @@have_uncaught_throw_error return nil unless @error.is_a?(UncaughtThrowError) tag = @error.tag else pattern = UncaughtThrowPatterns[@error.class] return nil if pattern.nil? return nil unless pattern =~ @error. tag = $1 end normalize_tag(tag) end
#normalize_tag(tag) (private)
[ GitHub ]# File 'lib/test/unit/assertions.rb', line 836
def normalize_tag(tag) case tag when /\A:/ tag[1..-1].intern when /\A`(.+)'\z/ $1.intern when String tag.intern else tag end end