Class: SyntaxTree::CSS::URLToken

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

Overview

A parsed token that contains a URL. Note that this is different from a function call to the “url” function only if quotes aren’t used. www.w3.org/TR/css-syntax-3/#typedef-url-token

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(value:, location:) ⇒ URLToken

Returns a new instance of URLToken.



924
925
926
927
# File 'lib/syntax_tree/css/nodes.rb', line 924

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

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



922
923
924
# File 'lib/syntax_tree/css/nodes.rb', line 922

def location
  @location
end

#valueObject (readonly)

Returns the value of attribute value.



922
923
924
# File 'lib/syntax_tree/css/nodes.rb', line 922

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



929
930
931
# File 'lib/syntax_tree/css/nodes.rb', line 929

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

#child_nodesObject Also known as: deconstruct



933
934
935
# File 'lib/syntax_tree/css/nodes.rb', line 933

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



939
940
941
# File 'lib/syntax_tree/css/nodes.rb', line 939

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