struct Spectator::Location
 
  - Spectator::Location
 - Struct
 - Value
 - Object
 
Overview
Defines the file and line number a piece of code originated from.
Defined in:
spectator/location.crConstructors
- 
        .new(file : String, line : Int32, end_line = nil)
        
          
Creates the location.
 
Class Method Summary
- 
        .parse(string)
        
          
Parses a location from a string.
 
Instance Method Summary
- 
        #end_line : Int32
        
          
Ending line number in the file.
 - 
        #file : String
        
          
Absolute file path.
 - 
        #line : Int32
        
          
Starting line number in the file.
 - 
        #path
        
          
The relative path to the file from the current directory.
 - 
        #to_s(io : IO) : Nil
        
          
String representation of the location.
 
Instance methods inherited from class Object
  
  
    
      should(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall Ushould(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
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.
Instance Method Detail
        
        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.