Class: Herb::Errors::UnclosedQuoteError
- 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_quote ⇒ Object
readonly
| opening_quote: Herb::Token?, | }.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(type, location, message, opening_quote) ⇒ UnclosedQuoteError
constructor
: (String, Location?, String, Herb::Token) -> void.
-
#inspect ⇒ Object
: () -> String.
-
#to_hash ⇒ Object
: () -> serialized_unclosed_quote_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_quote) ⇒ UnclosedQuoteError
: (String, Location?, String, Herb::Token) -> void
833 834 835 836 |
# File 'lib/herb/errors.rb', line 833 def initialize(type, location, , opening_quote) super(type, location, ) @opening_quote = opening_quote end |
Instance Attribute Details
#opening_quote ⇒ Object (readonly)
| opening_quote: Herb::Token?, | }
830 831 832 |
# File 'lib/herb/errors.rb', line 830 def opening_quote @opening_quote end |
Instance Method Details
#inspect ⇒ Object
: () -> String
839 840 841 |
# File 'lib/herb/errors.rb', line 839 def inspect tree_inspect.rstrip.gsub(/\s+$/, "") end |
#to_hash ⇒ Object
: () -> serialized_unclosed_quote_error
844 845 846 847 848 |
# File 'lib/herb/errors.rb', line 844 def to_hash super.merge( opening_quote: opening_quote ) #: Herb::serialized_unclosed_quote_error end |
#tree_inspect(indent: 0, depth: 0, depth_limit: 25) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
851 852 853 854 855 856 857 858 859 860 861 862 |
# File 'lib/herb/errors.rb', line 851 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_quote: ") output += opening_quote ? opening_quote.tree_inspect : magenta("∅") output += "\n" output += %(\n) output.gsub(/^/, " " * indent) end |