Class: ArchUnit::Common::Extraction::ParseDiagnostic
- Inherits:
-
Data
- Object
- Data
- ArchUnit::Common::Extraction::ParseDiagnostic
- Defined in:
- lib/archunit/common/extraction/parse_diagnostic.rb
Overview
Immutable parser failure location; line and column are both one-based.
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path:, line:, column:, message:) ⇒ ParseDiagnostic
constructor
A new instance of ParseDiagnostic.
Constructor Details
#initialize(path:, line:, column:, message:) ⇒ ParseDiagnostic
Returns a new instance of ParseDiagnostic.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/archunit/common/extraction/parse_diagnostic.rb', line 8 def initialize(path:, line:, column:, message:) unless [path, ].all? { |value| value.is_a?(String) && !value.empty? } raise ArgumentError, 'parse diagnostic requires a non-empty path and message' end unless [line, column].all? { |value| value.is_a?(Integer) && value.positive? } raise ArgumentError, 'parse diagnostic coordinates must be positive integers' end path = path.tr('\\', '/').freeze = .dup.freeze super end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column
7 8 9 |
# File 'lib/archunit/common/extraction/parse_diagnostic.rb', line 7 def column @column end |
#line ⇒ Object (readonly)
Returns the value of attribute line
7 8 9 |
# File 'lib/archunit/common/extraction/parse_diagnostic.rb', line 7 def line @line end |
#message ⇒ Object (readonly)
Returns the value of attribute message
7 8 9 |
# File 'lib/archunit/common/extraction/parse_diagnostic.rb', line 7 def @message end |
#path ⇒ Object (readonly)
Returns the value of attribute path
7 8 9 |
# File 'lib/archunit/common/extraction/parse_diagnostic.rb', line 7 def path @path end |
ArchUnitRuby