Class: SyntaxTree::CSS::Declaration
- Defined in:
- lib/syntax_tree/css/nodes.rb
Overview
Declarations are a particular instance of associating a property or descriptor name with a value. www.w3.org/TR/css-syntax-3/#declaration
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#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
- #important? ⇒ Boolean
-
#initialize(name:, value:, important:, location:) ⇒ Declaration
constructor
A new instance of Declaration.
Methods inherited from Node
Constructor Details
#initialize(name:, value:, important:, location:) ⇒ Declaration
Returns a new instance of Declaration.
385 386 387 388 389 390 |
# File 'lib/syntax_tree/css/nodes.rb', line 385 def initialize(name:, value:, important:, location:) @name = name @value = value @important = important @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
383 384 385 |
# File 'lib/syntax_tree/css/nodes.rb', line 383 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
383 384 385 |
# File 'lib/syntax_tree/css/nodes.rb', line 383 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
383 384 385 |
# File 'lib/syntax_tree/css/nodes.rb', line 383 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
392 393 394 |
# File 'lib/syntax_tree/css/nodes.rb', line 392 def accept(visitor) visitor.visit_declaration(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
396 397 398 |
# File 'lib/syntax_tree/css/nodes.rb', line 396 def child_nodes value end |
#deconstruct_keys(keys) ⇒ Object
402 403 404 |
# File 'lib/syntax_tree/css/nodes.rb', line 402 def deconstruct_keys(keys) { name: name, value: value, important: important?, location: location } end |
#important? ⇒ Boolean
406 407 408 |
# File 'lib/syntax_tree/css/nodes.rb', line 406 def important? @important end |