Class: Herb::Errors::UnclosedOpenTagError
- 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
-
#tag_name ⇒ Object
readonly
| tag_name: Herb::Token?, | }.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(type, location, message, tag_name) ⇒ UnclosedOpenTagError
constructor
: (String, Location?, String, Herb::Token) -> void.
-
#inspect ⇒ Object
: () -> String.
-
#to_hash ⇒ Object
: () -> serialized_unclosed_open_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, tag_name) ⇒ UnclosedOpenTagError
: (String, Location?, String, Herb::Token) -> void
751 752 753 754 |
# File 'lib/herb/errors.rb', line 751 def initialize(type, location, , tag_name) super(type, location, ) @tag_name = tag_name end |
Instance Attribute Details
#tag_name ⇒ Object (readonly)
| tag_name: Herb::Token?, | }
748 749 750 |
# File 'lib/herb/errors.rb', line 748 def tag_name @tag_name end |
Instance Method Details
#inspect ⇒ Object
: () -> String
757 758 759 |
# File 'lib/herb/errors.rb', line 757 def inspect tree_inspect.rstrip.gsub(/\s+$/, "") end |
#to_hash ⇒ Object
: () -> serialized_unclosed_open_tag_error
762 763 764 765 766 |
# File 'lib/herb/errors.rb', line 762 def to_hash super.merge( tag_name: tag_name ) #: Herb::serialized_unclosed_open_tag_error end |
#tree_inspect(indent: 0, depth: 0, depth_limit: 25) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
769 770 771 772 773 774 775 776 777 778 779 780 |
# File 'lib/herb/errors.rb', line 769 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("└── tag_name: ") output += tag_name ? tag_name.tree_inspect : magenta("∅") output += "\n" output += %(\n) output.gsub(/^/, " " * indent) end |