Class: SyntaxTree::CSS::Selectors::PseudoClassFunction

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

Overview

A pseudo class function call, like :nth-child.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(name:, arguments:) ⇒ PseudoClassFunction

Returns a new instance of PseudoClassFunction.



108
109
110
111
# File 'lib/syntax_tree/css/selectors.rb', line 108

def initialize(name:, arguments:)
  @name = name
  @arguments = arguments
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



106
107
108
# File 'lib/syntax_tree/css/selectors.rb', line 106

def arguments
  @arguments
end

#nameObject (readonly)

Returns the value of attribute name.



106
107
108
# File 'lib/syntax_tree/css/selectors.rb', line 106

def name
  @name
end

Instance Method Details

#accept(visitor) ⇒ Object



113
114
115
# File 'lib/syntax_tree/css/selectors.rb', line 113

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

#child_nodesObject Also known as: deconstruct



117
118
119
# File 'lib/syntax_tree/css/selectors.rb', line 117

def child_nodes
  arguments
end

#deconstruct_keys(keys) ⇒ Object



123
124
125
# File 'lib/syntax_tree/css/selectors.rb', line 123

def deconstruct_keys(keys)
  { name: name, arguments: arguments }
end