Class: SyntaxTree::CSS::PercentageToken

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

Overview

A parsed token that contains a numeric value with a percentage sign. www.w3.org/TR/css-syntax-3/#typedef-percentage-token

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(value:, type:, location:) ⇒ PercentageToken

Returns a new instance of PercentageToken.



716
717
718
719
720
# File 'lib/syntax_tree/css/nodes.rb', line 716

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

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



714
715
716
# File 'lib/syntax_tree/css/nodes.rb', line 714

def location
  @location
end

#typeObject (readonly)

Returns the value of attribute type.



714
715
716
# File 'lib/syntax_tree/css/nodes.rb', line 714

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



714
715
716
# File 'lib/syntax_tree/css/nodes.rb', line 714

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



722
723
724
# File 'lib/syntax_tree/css/nodes.rb', line 722

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

#child_nodesObject Also known as: deconstruct



726
727
728
# File 'lib/syntax_tree/css/nodes.rb', line 726

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



732
733
734
# File 'lib/syntax_tree/css/nodes.rb', line 732

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