Class: SyntaxTree::CSS::FunctionToken

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

Overview

A parsed token that contains the beginning of a call to a function, e.g., “url(”. www.w3.org/TR/css-syntax-3/#typedef-function-token

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(value:, location:) ⇒ FunctionToken

Returns a new instance of FunctionToken.



527
528
529
530
# File 'lib/syntax_tree/css/nodes.rb', line 527

def initialize(value:, location:)
  @value = value
  @location = Location.from(location)
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



525
526
527
# File 'lib/syntax_tree/css/nodes.rb', line 525

def location
  @location
end

#valueObject (readonly)

Returns the value of attribute value.



525
526
527
# File 'lib/syntax_tree/css/nodes.rb', line 525

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



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

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

#child_nodesObject Also known as: deconstruct



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

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



542
543
544
# File 'lib/syntax_tree/css/nodes.rb', line 542

def deconstruct_keys(keys)
  { value: value, location: location }
end