Class: Herb::Errors::UnclosedERBTagError
- 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
-
#opening_tag ⇒ Object
readonly
| opening_tag: Herb::Token?, | }.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(type, location, message, opening_tag) ⇒ UnclosedERBTagError
constructor
: (String, Location?, String, Herb::Token) -> void.
-
#inspect ⇒ Object
: () -> String.
-
#to_hash ⇒ Object
: () -> serialized_unclosed_erb_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) ⇒ UnclosedERBTagError
: (String, Location?, String, Herb::Token) -> void
913 914 915 916 |
# File 'lib/herb/errors.rb', line 913 def initialize(type, location, , opening_tag) super(type, location, ) @opening_tag = opening_tag end |
Instance Attribute Details
#opening_tag ⇒ Object (readonly)
| opening_tag: Herb::Token?, | }
910 911 912 |
# File 'lib/herb/errors.rb', line 910 def opening_tag @opening_tag end |
Instance Method Details
#inspect ⇒ Object
: () -> String
919 920 921 |
# File 'lib/herb/errors.rb', line 919 def inspect tree_inspect.rstrip.gsub(/\s+$/, "") end |
#to_hash ⇒ Object
: () -> serialized_unclosed_erb_tag_error
924 925 926 927 928 |
# File 'lib/herb/errors.rb', line 924 def to_hash super.merge( opening_tag: opening_tag ) #: Herb::serialized_unclosed_erb_tag_error end |
#tree_inspect(indent: 0, depth: 0, depth_limit: 25) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
931 932 933 934 935 936 937 938 939 940 941 942 |
# File 'lib/herb/errors.rb', line 931 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 += %(\n) output.gsub(/^/, " " * indent) end |