Class: SyntaxTree::CSS::DimensionToken
- Defined in:
- lib/syntax_tree/css/nodes.rb
Overview
A parsed token that contains a numeric value with a dimension. www.w3.org/TR/css-syntax-3/#typedef-dimension-token
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(value:, unit:, type:, location:) ⇒ DimensionToken
constructor
A new instance of DimensionToken.
Methods inherited from Node
Constructor Details
#initialize(value:, unit:, type:, location:) ⇒ DimensionToken
Returns a new instance of DimensionToken.
441 442 443 444 445 446 |
# File 'lib/syntax_tree/css/nodes.rb', line 441 def initialize(value:, unit:, type:, location:) @value = value @unit = unit @type = type @location = Location.from(location) end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
439 440 441 |
# File 'lib/syntax_tree/css/nodes.rb', line 439 def location @location end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
439 440 441 |
# File 'lib/syntax_tree/css/nodes.rb', line 439 def type @type end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
439 440 441 |
# File 'lib/syntax_tree/css/nodes.rb', line 439 def unit @unit end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
439 440 441 |
# File 'lib/syntax_tree/css/nodes.rb', line 439 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
448 449 450 |
# File 'lib/syntax_tree/css/nodes.rb', line 448 def accept(visitor) visitor.visit_dimension_token(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
452 453 454 |
# File 'lib/syntax_tree/css/nodes.rb', line 452 def child_nodes [] end |
#deconstruct_keys(keys) ⇒ Object
458 459 460 |
# File 'lib/syntax_tree/css/nodes.rb', line 458 def deconstruct_keys(keys) { value: value, type: type, location: location } end |