Class: RSpec::Covers::CodeLocation

Inherits:
Struct
  • Object
show all
Defined in:
lib/rspec/covers/code_location.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file:, line:) ⇒ CodeLocation

Returns a new instance of CodeLocation.



8
9
10
# File 'lib/rspec/covers/code_location.rb', line 8

def initialize(file:, line:)
  super(file: File.expand_path(file), line: line.to_i)
end

Instance Attribute Details

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



7
8
9
# File 'lib/rspec/covers/code_location.rb', line 7

def file
  @file
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



7
8
9
# File 'lib/rspec/covers/code_location.rb', line 7

def line
  @line
end

Instance Method Details

#to_hObject



12
13
14
# File 'lib/rspec/covers/code_location.rb', line 12

def to_h
  { file: file, line: line }
end