Class: SyntaxTree::CSS::Selectors::TypeSelector

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

Overview

A selector for a specific tag name. www.w3.org/TR/selectors-4/#typedef-type-selector

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(prefix:, value:) ⇒ TypeSelector

Returns a new instance of TypeSelector.



183
184
185
186
# File 'lib/syntax_tree/css/selectors.rb', line 183

def initialize(prefix:, value:)
  @prefix = prefix
  @value = value
end

Instance Attribute Details

#prefixObject (readonly)

Returns the value of attribute prefix.



181
182
183
# File 'lib/syntax_tree/css/selectors.rb', line 181

def prefix
  @prefix
end

#valueObject (readonly)

Returns the value of attribute value.



181
182
183
# File 'lib/syntax_tree/css/selectors.rb', line 181

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



188
189
190
# File 'lib/syntax_tree/css/selectors.rb', line 188

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

#child_nodesObject Also known as: deconstruct



192
193
194
# File 'lib/syntax_tree/css/selectors.rb', line 192

def child_nodes
  [prefix, value]
end

#deconstruct_keys(keys) ⇒ Object



198
199
200
# File 'lib/syntax_tree/css/selectors.rb', line 198

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