Class: SyntaxTree::CSS::AtKeywordToken

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

Overview

A parsed token that is an identifier that starts with an @ sign. www.w3.org/TR/css-syntax-3/#typedef-at-keyword-token

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(value:, location:) ⇒ AtKeywordToken

Returns a new instance of AtKeywordToken.



45
46
47
48
# File 'lib/syntax_tree/css/nodes.rb', line 45

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

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



43
44
45
# File 'lib/syntax_tree/css/nodes.rb', line 43

def location
  @location
end

#valueObject (readonly)

Returns the value of attribute value.



43
44
45
# File 'lib/syntax_tree/css/nodes.rb', line 43

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



50
51
52
# File 'lib/syntax_tree/css/nodes.rb', line 50

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

#child_nodesObject Also known as: deconstruct



54
55
56
# File 'lib/syntax_tree/css/nodes.rb', line 54

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



60
61
62
# File 'lib/syntax_tree/css/nodes.rb', line 60

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