Class: Herb::Errors::NestedERBTagError
- 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
-
#nested_tag_column ⇒ Object
readonly
: Integer?.
-
#nested_tag_line ⇒ Object
readonly
: Integer?.
-
#opening_tag ⇒ Object
readonly
| opening_tag: Herb::Token?, | nested_tag_line: Integer?, | nested_tag_column: Integer?, | }.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(type, location, message, opening_tag, nested_tag_line, nested_tag_column) ⇒ NestedERBTagError
constructor
: (String, Location?, String, Herb::Token, Integer, Integer) -> void.
-
#inspect ⇒ Object
: () -> String.
-
#to_hash ⇒ Object
: () -> serialized_nested_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, nested_tag_line, nested_tag_column) ⇒ NestedERBTagError
: (String, Location?, String, Herb::Token, Integer, Integer) -> void
978 979 980 981 982 983 |
# File 'lib/herb/errors.rb', line 978 def initialize(type, location, , opening_tag, nested_tag_line, nested_tag_column) super(type, location, ) @opening_tag = opening_tag @nested_tag_line = nested_tag_line @nested_tag_column = nested_tag_column end |
Instance Attribute Details
#nested_tag_column ⇒ Object (readonly)
: Integer?
975 976 977 |
# File 'lib/herb/errors.rb', line 975 def nested_tag_column @nested_tag_column end |
#nested_tag_line ⇒ Object (readonly)
: Integer?
974 975 976 |
# File 'lib/herb/errors.rb', line 974 def nested_tag_line @nested_tag_line end |
#opening_tag ⇒ Object (readonly)
| opening_tag: Herb::Token?, | nested_tag_line: Integer?, | nested_tag_column: Integer?, | }
973 974 975 |
# File 'lib/herb/errors.rb', line 973 def opening_tag @opening_tag end |
Instance Method Details
#inspect ⇒ Object
: () -> String
986 987 988 |
# File 'lib/herb/errors.rb', line 986 def inspect tree_inspect.rstrip.gsub(/\s+$/, "") end |
#to_hash ⇒ Object
: () -> serialized_nested_erb_tag_error
991 992 993 994 995 996 997 |
# File 'lib/herb/errors.rb', line 991 def to_hash super.merge( opening_tag: opening_tag, nested_tag_line: nested_tag_line, nested_tag_column: nested_tag_column ) #: Herb::serialized_nested_erb_tag_error end |
#tree_inspect(indent: 0, depth: 0, depth_limit: 25) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 |
# File 'lib/herb/errors.rb', line 1000 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("├── nested_tag_line: #{green(nested_tag_line.inspect)}\n") output += white("└── nested_tag_column: #{green(nested_tag_column.inspect)}\n") output += %(\n) output.gsub(/^/, " " * indent) end |