Exception: Tryouts::TryoutSyntaxError
- Inherits:
-
StandardError
- Object
- StandardError
- Tryouts::TryoutSyntaxError
- Defined in:
- lib/tryouts/test_case.rb
Overview
Enhanced error with context
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#source_file ⇒ Object
readonly
Returns the value of attribute source_file.
Instance Method Summary collapse
-
#initialize(message, line_number:, context:, source_file: nil) ⇒ TryoutSyntaxError
constructor
A new instance of TryoutSyntaxError.
Constructor Details
#initialize(message, line_number:, context:, source_file: nil) ⇒ TryoutSyntaxError
Returns a new instance of TryoutSyntaxError.
183 184 185 186 187 188 189 190 |
# File 'lib/tryouts/test_case.rb', line 183 def initialize(, line_number:, context:, source_file: nil) @line_number = line_number @context = context @source_file = source_file location = source_file ? "#{source_file}:#{line_number}" : "line #{line_number}" super("#{} at #{location}: #{context}") end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
181 182 183 |
# File 'lib/tryouts/test_case.rb', line 181 def context @context end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
181 182 183 |
# File 'lib/tryouts/test_case.rb', line 181 def line_number @line_number end |
#source_file ⇒ Object (readonly)
Returns the value of attribute source_file.
181 182 183 |
# File 'lib/tryouts/test_case.rb', line 181 def source_file @source_file end |