Class: Less2Sass::Less::Tree::QuotedNode
- Defined in:
- lib/less2sass/less/tree/quoted_node.rb
Overview
Represents a single or double-quoted string in Less.
The Sass equivalent is a Sass::Script::Value::String wrapped in Sass::Script::Tree::Literal.
Instance Attribute Summary collapse
-
#currentFileInfo ⇒ Object
Returns the value of attribute currentFileInfo.
-
#escaped ⇒ Object
Returns the value of attribute escaped.
-
#index ⇒ Object
Returns the value of attribute index.
-
#quote ⇒ Object
Returns the value of attribute quote.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Node
#children, #has_children, #has_parent, #line, #parent, #ref_vars
Instance Method Summary collapse
-
#string_interpolation?(value = @value) ⇒ Boolean
Checks, whether the quoted string contains an interpolation.
-
#to_s ⇒ Object
Returns the string’s raw value without passing the type of quote.
-
#to_sass ⇒ ::Sass::Script::Tree::Literal, ::Sass::Script::Tree::StringInterpolation
Returns the Sass equivalent for a quoted string.
Methods inherited from Node
#<<, #==, #contains_variables?, #creates_context?, #each, #get_referenced_variable_names, #initialize, #transform
Constructor Details
This class inherits a constructor from Less2Sass::Less::Tree::Node
Instance Attribute Details
#currentFileInfo ⇒ Object
Returns the value of attribute currentFileInfo.
13 14 15 |
# File 'lib/less2sass/less/tree/quoted_node.rb', line 13 def currentFileInfo @currentFileInfo end |
#escaped ⇒ Object
Returns the value of attribute escaped.
9 10 11 |
# File 'lib/less2sass/less/tree/quoted_node.rb', line 9 def escaped @escaped end |
#index ⇒ Object
Returns the value of attribute index.
12 13 14 |
# File 'lib/less2sass/less/tree/quoted_node.rb', line 12 def index @index end |
#quote ⇒ Object
Returns the value of attribute quote.
11 12 13 |
# File 'lib/less2sass/less/tree/quoted_node.rb', line 11 def quote @quote end |
#value ⇒ Object
Returns the value of attribute value.
10 11 12 |
# File 'lib/less2sass/less/tree/quoted_node.rb', line 10 def value @value end |
Instance Method Details
#string_interpolation?(value = @value) ⇒ Boolean
Checks, whether the quoted string contains an interpolation.
40 41 42 |
# File 'lib/less2sass/less/tree/quoted_node.rb', line 40 def string_interpolation?(value = @value) !value.index(INTERPOLATION).nil? end |
#to_s ⇒ Object
Returns the string’s raw value without passing the type of quote.
Sass has its own standards regarding the quotes, it should be in Sass’ competences to choose what type of quote to use.
33 34 35 |
# File 'lib/less2sass/less/tree/quoted_node.rb', line 33 def to_s @value end |
#to_sass ⇒ ::Sass::Script::Tree::Literal, ::Sass::Script::Tree::StringInterpolation
Returns the Sass equivalent for a quoted string.
21 22 23 24 25 26 27 |
# File 'lib/less2sass/less/tree/quoted_node.rb', line 21 def to_sass if string_interpolation? interpolation_node(@value) else node(::Sass::Script::Tree::Literal.new(::Sass::Script::Value::String.new(@value, :string)), line) end end |