Class: Herb::Errors::InvalidCommentClosingTagError
- Includes:
- Colors
- Defined in:
- lib/herb/errors.rb,
ext/herb/error_helpers.c
Constant Summary
Constants included from Colors
Colors::CLEAR_SCREEN, Colors::HIDE_CURSOR, Colors::SHOW_CURSOR
Instance Attribute Summary collapse
-
#closing_tag ⇒ Object
readonly
| closing_tag: Herb::Token?, | }.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(type, location, message, closing_tag) ⇒ InvalidCommentClosingTagError
constructor
: (String, Location?, String, Herb::Token) -> void.
-
#inspect ⇒ Object
: () -> String.
-
#to_hash ⇒ Object
: () -> serialized_invalid_comment_closing_tag_error.
-
#tree_inspect(indent: 0, depth: 0, depth_limit: 25) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String.
Methods included from Colors
bold, bright_magenta, cyan, dimmed, enabled?, fg, fg_bg, green, magenta, red, white, yellow
Methods inherited from Error
#class_name, #error_name, #to_json
Constructor Details
#initialize(type, location, message, closing_tag) ⇒ InvalidCommentClosingTagError
: (String, Location?, String, Herb::Token) -> void
662 663 664 665 |
# File 'lib/herb/errors.rb', line 662 def initialize(type, location, , closing_tag) super(type, location, ) @closing_tag = closing_tag end |
Instance Attribute Details
#closing_tag ⇒ Object (readonly)
| closing_tag: Herb::Token?, | }
659 660 661 |
# File 'lib/herb/errors.rb', line 659 def closing_tag @closing_tag end |
Instance Method Details
#inspect ⇒ Object
: () -> String
668 669 670 |
# File 'lib/herb/errors.rb', line 668 def inspect tree_inspect.rstrip.gsub(/\s+$/, "") end |
#to_hash ⇒ Object
: () -> serialized_invalid_comment_closing_tag_error
673 674 675 676 677 |
# File 'lib/herb/errors.rb', line 673 def to_hash super.merge( closing_tag: closing_tag ) #: Herb::serialized_invalid_comment_closing_tag_error end |
#tree_inspect(indent: 0, depth: 0, depth_limit: 25) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
680 681 682 683 684 685 686 687 688 689 690 691 |
# File 'lib/herb/errors.rb', line 680 def tree_inspect(indent: 0, depth: 0, depth_limit: 25) output = +"" output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}") output += white("├── message: #{green(.inspect)}\n") output += white("└── closing_tag: ") output += closing_tag ? closing_tag.tree_inspect : magenta("∅") output += "\n" output += %(\n) output.gsub(/^/, " " * indent) end |