Sha256: fb56596daa1547a2b0d9ba5aadb6c1f5c7f0fce4de4d8103b41331b18de0109b

Contents?: true

Size: 445 Bytes

Versions: 8

Compression:

Stored size: 445 Bytes

Contents

# frozen_string_literal: true

module Assert
  class ContextInfo
    attr_reader :called_from, :klass, :file

    def initialize(klass, called_from = nil, first_caller = nil)
      @called_from = called_from || first_caller
      @klass = klass
      @file = @called_from.to_s.gsub(/\:[0-9]+.*$/, "") if @called_from
    end

    def test_name(name)
      [klass.description.to_s, name.to_s].compact.reject(&:empty?).join(" ")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
assert-2.19.8 lib/assert/context_info.rb
assert-2.19.7 lib/assert/context_info.rb
assert-2.19.6 lib/assert/context_info.rb
assert-2.19.5 lib/assert/context_info.rb
assert-2.19.4 lib/assert/context_info.rb
assert-2.19.3 lib/assert/context_info.rb
assert-2.19.2 lib/assert/context_info.rb
assert-2.19.1 lib/assert/context_info.rb