Class Index [+]

Quicksearch

RSpec::Core::Metadata::MetadataHash

@private

Public Instance Methods

[](key) click to toggle source

@private Supports lazy evaluation of some values. Extended by ExampleMetadataHash and GroupMetadataHash, which get mixed in to Metadata for ExampleGroups and Examples (respectively).

    # File lib/rspec/core/metadata.rb, line 43
43:         def [](key)
44:           return super if has_key?(key)
45:           case key
46:           when :location
47:             store(:location, location)
48:           when :file_path, :line_number
49:             file_path, line_number = file_and_line_number
50:             store(:file_path, file_path)
51:             store(:line_number, line_number)
52:             super
53:           when :execution_result
54:             store(:execution_result, {})
55:           when :describes, :described_class
56:             klass = described_class
57:             store(:described_class, klass)
58:             # TODO (2011-11-07 DC) deprecate :describes as a key
59:             store(:describes, klass)
60:           when :full_description
61:             store(:full_description, full_description)
62:           when :description
63:             store(:description, build_description_from(*self[:description_args]))
64:           else
65:             super
66:           end
67:         end

Private Instance Methods

build_description_from(*parts) click to toggle source
    # File lib/rspec/core/metadata.rb, line 84
84:         def build_description_from(*parts)
85:           parts.map {|p| p.to_s}.inject do |desc, p|
86:             p =~ /^(#|::|\.)/ ? "#{desc}#{p}" : "#{desc} #{p}"
87:           end || ""
88:         end
file_and_line_number() click to toggle source
    # File lib/rspec/core/metadata.rb, line 75
75:         def file_and_line_number
76:           first_caller_from_outside_rspec =~ /(.+?):(\d+)(|:\d+)/
77:           return [Metadata::relative_path($1), $2.to_i]
78:         end
first_caller_from_outside_rspec() click to toggle source
    # File lib/rspec/core/metadata.rb, line 80
80:         def first_caller_from_outside_rspec
81:           self[:caller].detect {|l| l !~ /\/lib\/rspec\/core/}
82:         end
location() click to toggle source
    # File lib/rspec/core/metadata.rb, line 71
71:         def location
72:           "#{self[:file_path]}:#{self[:line_number]}"
73:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.