mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add source class
This commit is contained in:
parent
04bccd162e
commit
dc66b184e2
2 changed files with 23 additions and 0 deletions
|
@ -42,4 +42,5 @@ require "./pending_result"
|
||||||
require "./failed_result"
|
require "./failed_result"
|
||||||
require "./errored_result"
|
require "./errored_result"
|
||||||
|
|
||||||
|
require "./source"
|
||||||
require "./example_iterator"
|
require "./example_iterator"
|
||||||
|
|
22
src/spectator/source.cr
Normal file
22
src/spectator/source.cr
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
module Spectator
|
||||||
|
# Define the file and line number something originated from.
|
||||||
|
struct Source
|
||||||
|
# Absolute file path.
|
||||||
|
getter file : String
|
||||||
|
|
||||||
|
# Line number in the file.
|
||||||
|
getter line : Int32
|
||||||
|
|
||||||
|
# Creates the source.
|
||||||
|
def initialize(@file, @line)
|
||||||
|
end
|
||||||
|
|
||||||
|
# String representation of the source.
|
||||||
|
# This is formatted as `FILE:LINE`.
|
||||||
|
def to_s(io)
|
||||||
|
io << file
|
||||||
|
io << ':'
|
||||||
|
io << line
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue