Class: SyntaxTree::CSS::Function

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

Overview

A function has a name and a value consisting of a list of component values. www.w3.org/TR/css-syntax-3/#function

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(name:, value:, location:) ⇒ Function

Returns a new instance of Function.



500
501
502
503
504
# File 'lib/syntax_tree/css/nodes.rb', line 500

def initialize(name:, value:, location:)
  @name = name
  @value = value
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



498
499
500
# File 'lib/syntax_tree/css/nodes.rb', line 498

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



498
499
500
# File 'lib/syntax_tree/css/nodes.rb', line 498

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



498
499
500
# File 'lib/syntax_tree/css/nodes.rb', line 498

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



506
507
508
# File 'lib/syntax_tree/css/nodes.rb', line 506

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

#child_nodesObject Also known as: deconstruct



510
511
512
# File 'lib/syntax_tree/css/nodes.rb', line 510

def child_nodes
  value
end

#deconstruct_keys(keys) ⇒ Object



516
517
518
# File 'lib/syntax_tree/css/nodes.rb', line 516

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