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



120
121
122
123
124
125
126
127
# File 'lib/less/engine/nodes/literal.rb', line 120

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.



117
118
119
# File 'lib/less/engine/nodes/literal.rb', line 117

def content
  @content
end

#quotesObject (readonly)

Returns the value of attribute quotes.



117
118
119
# File 'lib/less/engine/nodes/literal.rb', line 117

def quotes
  @quotes
end

Instance Method Details

#to_cssObject



129
130
131
# File 'lib/less/engine/nodes/literal.rb', line 129

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