struct Spectator::Location

Overview

Defines the file and line number a piece of code originated from.

Defined in:

spectator/location.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

should(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should(matcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should
, should_eventually(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_eventually, should_never(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_never, should_not(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should_not(matcher : Spectator::Matchers::NilMatcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not(matcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not

Constructor Detail

def self.new(file : String, line : Int32, end_line = nil) #

Creates the location.


[View source]

Class Method Detail

def self.parse(string) #

Parses a location from a string. The string should be in the form:

FILE:LINE

This matches the output of the #to_s method.


[View source]

Instance Method Detail

def end_line : Int32 #

Ending line number in the file.


[View source]
def file : String #

Absolute file path.


[View source]
def line : Int32 #

Starting line number in the file.


[View source]
def path #

The relative path to the file from the current directory. If the file isn't in the current directory or a sub-directory, then the absolute path is provided.


[View source]
def to_s(io : IO) : Nil #

String representation of the location. This is formatted as:

FILE:LINE

[View source]