Class: Less::Node::String

Inherits:
String show all
Includes:
Literal
Defined in:
lib/less/engine/nodes/literal.rb

Overview

“hello world”

Instance Attribute Summary collapse

Attributes included from Entity

#parent

Instance Method Summary collapse

Methods included from Literal

#unit

Methods included from Entity

#inspect, #path, #root, #to_s

Methods inherited from String

#blank?, #column_of, #indent, #line_of, #tabto, #treetop_camelize

Constructor Details

#initialize(str) ⇒ String

Strip quotes if necessary, and save them in @quotes



128
129
130
131
132
133
134
135
# File 'lib/less/engine/nodes/literal.rb', line 128

def initialize str
  @quotes, @content = unless str.nil? or str.empty?
    str.match(/('|")(.*?)(\1)/).captures rescue [nil, str]
  else
    [nil, ""]
  end
  super @content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



125
126
127
# File 'lib/less/engine/nodes/literal.rb', line 125

def content
  @content
end

#quotesObject (readonly)

Returns the value of attribute quotes.



125
126
127
# File 'lib/less/engine/nodes/literal.rb', line 125

def quotes
  @quotes
end

Instance Method Details

#to_cssObject



137
138
139
# File 'lib/less/engine/nodes/literal.rb', line 137

def to_css
  "#@quotes#{@content}#@quotes"
end