struct Spectator::Source

Overview

Define the file and line number something originated from.

Defined in:

spectator/source.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

should(matcher) should, should_eventually(matcher) should_eventually, should_never(matcher) should_never, should_not(matcher) should_not

Constructor Detail

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

Creates the source.


[View source]

Class Method Detail

def self.parse(string) #

Parses a source from a string.


[View source]

Instance Method Detail

def file : String #

Absolute file path.


[View source]
def line : Int32 #

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_json(json : JSON::Builder) #

Creates the JSON representation of the source.


[View source]
def to_s(io) #

String representation of the source. This is formatted as:

FILE:LINE

[View source]