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

Constructor Details

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

Returns a new instance of HtmlString.



418
419
420
421
422
423
# File 'lib/syntax_tree/erb/nodes.rb', line 418

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.



416
417
418
# File 'lib/syntax_tree/erb/nodes.rb', line 416

def closing
  @closing
end

#contentsObject (readonly)

Returns the value of attribute contents.



416
417
418
# File 'lib/syntax_tree/erb/nodes.rb', line 416

def contents
  @contents
end

#locationObject (readonly)

Returns the value of attribute location.



416
417
418
# File 'lib/syntax_tree/erb/nodes.rb', line 416

def location
  @location
end

#openingObject (readonly)

Returns the value of attribute opening.



416
417
418
# File 'lib/syntax_tree/erb/nodes.rb', line 416

def opening
  @opening
end

Instance Method Details

#accept(visitor) ⇒ Object



425
426
427
# File 'lib/syntax_tree/erb/nodes.rb', line 425

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

#child_nodesObject Also known as: deconstruct



429
430
431
# File 'lib/syntax_tree/erb/nodes.rb', line 429

def child_nodes
  [*contents]
end

#deconstruct_keys(keys) ⇒ Object



435
436
437
438
439
440
441
442
# File 'lib/syntax_tree/erb/nodes.rb', line 435

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