Class: Herb::AST::RubyHTMLAttributesSplatNode
- Includes:
- Colors
- Defined in:
- lib/herb/ast/nodes.rb,
ext/herb/nodes.c
Overview
: type serialized_ruby_html_attributes_splat_node = { | content: String?, | prefix: String?, | }
Constant Summary
Constants included from Colors
Colors::CLEAR_SCREEN, Colors::HIDE_CURSOR, Colors::SHOW_CURSOR
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
: String?.
-
#prefix ⇒ Object
readonly
: String?.
Attributes inherited from Node
#errors, #location, #source, #type
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
: (Visitor) -> void.
-
#child_nodes ⇒ Object
: () -> Array.
-
#compact_child_nodes ⇒ Object
: () -> Array.
-
#initialize(type, location, errors, content, prefix) ⇒ RubyHTMLAttributesSplatNode
constructor
: (String, Location, Array, String, String) -> void.
-
#inspect ⇒ Object
: () -> String.
-
#to_hash ⇒ Object
: () -> serialized_ruby_html_attributes_splat_node.
-
#tree_inspect(indent: 0, depth: 0, depth_limit: 10) ⇒ 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 Node
#class_name, #inspect_array, #inspect_errors, #node_name, #recursive_errors, #to_json
Constructor Details
#initialize(type, location, errors, content, prefix) ⇒ RubyHTMLAttributesSplatNode
: (String, Location, Array, String, String) -> void
1108 1109 1110 1111 1112 |
# File 'lib/herb/ast/nodes.rb', line 1108 def initialize(type, location, errors, content, prefix) super(type, location, errors) @content = content&.force_encoding("utf-8") @prefix = prefix&.force_encoding("utf-8") end |
Instance Attribute Details
#content ⇒ Object (readonly)
: String?
1104 1105 1106 |
# File 'lib/herb/ast/nodes.rb', line 1104 def content @content end |
#prefix ⇒ Object (readonly)
: String?
1105 1106 1107 |
# File 'lib/herb/ast/nodes.rb', line 1105 def prefix @prefix end |
Instance Method Details
#accept(visitor) ⇒ Object
: (Visitor) -> void
1123 1124 1125 |
# File 'lib/herb/ast/nodes.rb', line 1123 def accept(visitor) visitor.visit_ruby_html_attributes_splat_node(self) end |
#child_nodes ⇒ Object
: () -> Array
1128 1129 1130 |
# File 'lib/herb/ast/nodes.rb', line 1128 def child_nodes [] end |
#compact_child_nodes ⇒ Object
: () -> Array
1133 1134 1135 |
# File 'lib/herb/ast/nodes.rb', line 1133 def compact_child_nodes child_nodes.compact end |
#inspect ⇒ Object
: () -> String
1138 1139 1140 |
# File 'lib/herb/ast/nodes.rb', line 1138 def inspect tree_inspect.rstrip.gsub(/\s+$/, "") end |
#to_hash ⇒ Object
: () -> serialized_ruby_html_attributes_splat_node
1115 1116 1117 1118 1119 1120 |
# File 'lib/herb/ast/nodes.rb', line 1115 def to_hash super.merge({ content: content, prefix: prefix, }) #: Herb::serialized_ruby_html_attributes_splat_node end |
#tree_inspect(indent: 0, depth: 0, depth_limit: 10) ⇒ Object
: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 |
# File 'lib/herb/ast/nodes.rb', line 1143 def tree_inspect(indent: 0, depth: 0, depth_limit: 10) output = +"" output += white("@ #{bold(yellow(node_name.to_s))} #{dimmed("(location: #{location.tree_inspect})")}") output += "\n" if depth >= depth_limit output += dimmed("└── [depth limit reached ...]\n\n") return output.gsub(/^/, " " * indent) end output += inspect_errors(prefix: "│ ") output += white("├── content: ") + green("#{content.inspect}\n") output += white("└── prefix: ") + green("#{prefix.inspect}\n") output += "\n" output.gsub(/^/, " " * indent) end |