Class: Steep::Errors::Base
- Inherits:
-
Object
- Object
- Steep::Errors::Base
- Defined in:
- lib/steep/errors.rb
Direct Known Subclasses
ArgumentTypeMismatch, BlockParameterTypeMismatch, BlockTypeMismatch, BreakTypeMismatch, ElseOnExhaustiveCase, FallbackAny, IncompatibleAnnotation, IncompatibleArguments, IncompatibleAssignment, IncompatibleBlockParameters, IncompatibleMethodTypeAnnotation, IncompatibleTuple, IncompatibleTypeCase, IncompatibleZuper, MethodArityMismatch, MethodBodyTypeMismatch, MethodDefinitionMissing, MethodDefinitionWithOverloading, MethodReturnTypeAnnotationMismatch, MissingKeyword, NoMethod, RequiredBlockMissing, ReturnTypeMismatch, UnexpectedBlockGiven, UnexpectedDynamicMethod, UnexpectedJump, UnexpectedJumpValue, UnexpectedKeyword, UnexpectedSplat, UnexpectedSuper, UnexpectedYield, UnknownConstantAssigned, UnsatisfiableConstraint
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
-
#initialize(node:) ⇒ Base
constructor
A new instance of Base.
- #location_to_str ⇒ Object
- #print_to(io) ⇒ Object
Constructor Details
#initialize(node:) ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'lib/steep/errors.rb', line 6 def initialize(node:) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
4 5 6 |
# File 'lib/steep/errors.rb', line 4 def node @node end |
Instance Method Details
#location_to_str ⇒ Object
10 11 12 |
# File 'lib/steep/errors.rb', line 10 def location_to_str Rainbow("#{node.loc.expression.source_buffer.name}:#{node.loc.first_line}:#{node.loc.column}").red end |
#print_to(io) ⇒ Object
14 15 16 17 |
# File 'lib/steep/errors.rb', line 14 def print_to(io) source = node.loc.expression.source io.puts "#{to_s} (#{Rainbow(source.split(/\n/).first).blue})" end |