Class: SyntaxTree::ERB::HtmlString

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/erb/nodes.rb

Overview

A HtmlString can include ERB-tags

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print, #skip?, #without_new_line

Constructor Details

#initialize(opening:, contents:, closing:, location:) ⇒ HtmlString

Returns a new instance of HtmlString.



525
526
527
528
529
530
# File 'lib/syntax_tree/erb/nodes.rb', line 525

def initialize(opening:, contents:, closing:, location:)
  @opening = opening
  @contents = contents
  @closing = closing
  @location = location
end

Instance Attribute Details

#closingObject (readonly)

Returns the value of attribute closing.



523
524
525
# File 'lib/syntax_tree/erb/nodes.rb', line 523

def closing
  @closing
end

#contentsObject (readonly)

Returns the value of attribute contents.



523
524
525
# File 'lib/syntax_tree/erb/nodes.rb', line 523

def contents
  @contents
end

#locationObject (readonly)

Returns the value of attribute location.



523
524
525
# File 'lib/syntax_tree/erb/nodes.rb', line 523

def location
  @location
end

#openingObject (readonly)

Returns the value of attribute opening.



523
524
525
# File 'lib/syntax_tree/erb/nodes.rb', line 523

def opening
  @opening
end

Instance Method Details

#accept(visitor) ⇒ Object



532
533
534
# File 'lib/syntax_tree/erb/nodes.rb', line 532

def accept(visitor)
  visitor.visit_html_string(self)
end

#child_nodesObject Also known as: deconstruct



536
537
538
# File 'lib/syntax_tree/erb/nodes.rb', line 536

def child_nodes
  [*contents]
end

#deconstruct_keys(keys) ⇒ Object



542
543
544
545
546
547
548
549
# File 'lib/syntax_tree/erb/nodes.rb', line 542

def deconstruct_keys(keys)
  {
    opening: opening,
    contents: contents,
    closing: closing,
    location: location
  }
end