Class: Herb::Errors::OmittedClosingTagError
- 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
-
#insertion_point ⇒ Object
readonly
: Herb::Position?.
-
#opening_tag ⇒ Object
readonly
| opening_tag: Herb::Token?, | insertion_point: Herb::Position?, | }.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(type, location, message, opening_tag, insertion_point) ⇒ OmittedClosingTagError
constructor
: (String, Location?, String, Herb::Token, Herb::Position) -> void.
-
#inspect ⇒ Object
: () -> String.
-
#to_hash ⇒ Object
: () -> serialized_omitted_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, opening_tag, insertion_point) ⇒ OmittedClosingTagError
: (String, Location?, String, Herb::Token, Herb::Position) -> void
705 706 707 708 709 |
# File 'lib/herb/errors.rb', line 705 def initialize(type, location, , opening_tag, insertion_point) super(type, location, ) @opening_tag = opening_tag @insertion_point = insertion_point end |
Instance Attribute Details
#insertion_point ⇒ Object (readonly)
: Herb::Position?
702 703 704 |
# File 'lib/herb/errors.rb', line 702 def insertion_point @insertion_point end |
#opening_tag ⇒ Object (readonly)
| opening_tag: Herb::Token?, | insertion_point: Herb::Position?, | }
701 702 703 |
# File 'lib/herb/errors.rb', line 701 def opening_tag @opening_tag end |
Instance Method Details
#inspect ⇒ Object
: () -> String
712 713 714 |
# File 'lib/herb/errors.rb', line 712 def inspect tree_inspect.rstrip.gsub(/\s+$/, "") end |
#to_hash ⇒ Object
: () -> serialized_omitted_closing_tag_error
717 718 719 720 721 722 |
# File 'lib/herb/errors.rb', line 717 def to_hash super.merge( opening_tag: opening_tag, insertion_point: insertion_point ) #: Herb::serialized_omitted_closing_tag_error end |
#tree_inspect(indent: 0, depth: 0, depth_limit: 25) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 |
# File 'lib/herb/errors.rb', line 725 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("├── opening_tag: ") output += opening_tag ? opening_tag.tree_inspect : magenta("∅") output += "\n" output += white("└── insertion_point: ") output += insertion_point ? insertion_point.tree_inspect : magenta("∅") output += "\n" output += %(\n) output.gsub(/^/, " " * indent) end |