Class: SyntaxTree::ERB::HtmlAttribute
- Defined in:
- lib/syntax_tree/erb/nodes.rb
Overview
An HtmlAttribute is a key-value pair within a tag. It contains the key, the equals sign, and the value.
Instance Attribute Summary collapse
- 
  
    
      #equals  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute equals. 
- 
  
    
      #key  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute key. 
- 
  
    
      #location  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute location. 
- 
  
    
      #value  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute value. 
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- 
  
    
      #initialize(key:, equals:, value:, location:)  ⇒ HtmlAttribute 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of HtmlAttribute. 
Methods inherited from Node
#format, #pretty_print, #skip?, #without_new_line
Constructor Details
#initialize(key:, equals:, value:, location:) ⇒ HtmlAttribute
Returns a new instance of HtmlAttribute.
| 499 500 501 502 503 504 | # File 'lib/syntax_tree/erb/nodes.rb', line 499 def initialize(key:, equals:, value:, location:) @key = key @equals = equals @value = value @location = location end | 
Instance Attribute Details
#equals ⇒ Object (readonly)
Returns the value of attribute equals.
| 497 498 499 | # File 'lib/syntax_tree/erb/nodes.rb', line 497 def equals @equals end | 
#key ⇒ Object (readonly)
Returns the value of attribute key.
| 497 498 499 | # File 'lib/syntax_tree/erb/nodes.rb', line 497 def key @key end | 
#location ⇒ Object (readonly)
Returns the value of attribute location.
| 497 498 499 | # File 'lib/syntax_tree/erb/nodes.rb', line 497 def location @location end | 
#value ⇒ Object (readonly)
Returns the value of attribute value.
| 497 498 499 | # File 'lib/syntax_tree/erb/nodes.rb', line 497 def value @value end | 
Instance Method Details
#accept(visitor) ⇒ Object
| 506 507 508 | # File 'lib/syntax_tree/erb/nodes.rb', line 506 def accept(visitor) visitor.visit_attribute(self) end | 
#child_nodes ⇒ Object Also known as: deconstruct
| 510 511 512 | # File 'lib/syntax_tree/erb/nodes.rb', line 510 def child_nodes [key, equals, value] end | 
#deconstruct_keys(keys) ⇒ Object
| 516 517 518 | # File 'lib/syntax_tree/erb/nodes.rb', line 516 def deconstruct_keys(keys) { key: key, equals: equals, value: value, location: location } end |