Class: Herb::Errors::Error
- Inherits:
-
Object
- Object
- Herb::Errors::Error
- Defined in:
- lib/herb/errors.rb,
ext/herb/error_helpers.c
Direct Known Subclasses
ConditionalElementConditionMismatchError, ConditionalElementMultipleTagsError, DotNotationCasingError, ERBCaseWithConditionsError, ERBControlFlowScopeError, ERBMultipleBlocksInTagError, InvalidCommentClosingTagError, MissingAttributeValueError, MissingClosingTagError, MissingERBEndTagError, MissingOpeningTagError, NestedERBTagError, OmittedClosingTagError, RenderAmbiguousLocalsError, RenderConflictingPartialError, RenderInvalidAsOptionError, RenderLayoutWithoutBlockError, RenderMissingLocalsError, RenderNoArgumentsError, RenderObjectAndCollectionError, RubyParseError, StrayERBClosingTagError, StrictLocalsBlockArgumentError, StrictLocalsDuplicateDeclarationError, StrictLocalsMissingParenthesisError, StrictLocalsPositionalArgumentError, StrictLocalsSplatArgumentError, TagNamesMismatchError, UnclosedCloseTagError, UnclosedERBTagError, UnclosedElementError, UnclosedOpenTagError, UnclosedQuoteError, UnexpectedError, UnexpectedTokenError, VoidElementClosingTagError, VoidElementContentError
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
: Location?.
-
#message ⇒ Object
readonly
: String.
-
#type ⇒ Object
readonly
: String.
Instance Method Summary collapse
-
#class_name ⇒ Object
: () -> String.
-
#error_name ⇒ Object
: () -> String.
-
#initialize(type, location, message) ⇒ Error
constructor
: (String, Location?, String) -> void.
-
#to_hash ⇒ Object
: () -> serialized_error.
-
#to_json(state = nil) ⇒ Object
: (?untyped) -> String.
-
#tree_inspect(indent: 0, depth: 0, depth_limit: 25) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String.
Constructor Details
#initialize(type, location, message) ⇒ Error
: (String, Location?, String) -> void
20 21 22 23 24 |
# File 'lib/herb/errors.rb', line 20 def initialize(type, location, ) @type = type @location = location @message = end |
Instance Attribute Details
#location ⇒ Object (readonly)
: Location?
16 17 18 |
# File 'lib/herb/errors.rb', line 16 def location @location end |
#message ⇒ Object (readonly)
: String
17 18 19 |
# File 'lib/herb/errors.rb', line 17 def @message end |
#type ⇒ Object (readonly)
: String
15 16 17 |
# File 'lib/herb/errors.rb', line 15 def type @type end |
Instance Method Details
#class_name ⇒ Object
: () -> String
36 37 38 |
# File 'lib/herb/errors.rb', line 36 def class_name self.class.name || "Error" end |
#error_name ⇒ Object
: () -> String
41 42 43 |
# File 'lib/herb/errors.rb', line 41 def error_name class_name.split("::").last || "Error" end |
#to_hash ⇒ Object
: () -> serialized_error
27 28 29 30 31 32 33 |
# File 'lib/herb/errors.rb', line 27 def to_hash { type: type, location: location&.to_hash, message: , } end |
#to_json(state = nil) ⇒ Object
: (?untyped) -> String
46 47 48 |
# File 'lib/herb/errors.rb', line 46 def to_json(state = nil) to_hash.to_json(state) end |
#tree_inspect(indent: 0, depth: 0, depth_limit: 25) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
51 52 53 |
# File 'lib/herb/errors.rb', line 51 def tree_inspect(indent: 0, depth: 0, depth_limit: 25) raise NotImplementedError end |