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, message = nil) should, should_eventually(matcher, message = nil) should_eventually, should_never(matcher, message = nil) should_never, should_not(matcher, message = nil) should_not

Constructor Detail

def self.new(file, line, 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) #

String representation of the location. This is formatted as:

FILE:LINE

[View source]