Class: Less::Node::Quoted

Inherits:
String
  • Object
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

Constructor Details

#initialize(str) ⇒ Quoted

Strip quotes if necessary, and save them in @quotes



124
125
126
127
128
129
130
131
# File 'lib/less/engine/nodes/literal.rb', line 124

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.



121
122
123
# File 'lib/less/engine/nodes/literal.rb', line 121

def content
  @content
end

#quotesObject (readonly)

Returns the value of attribute quotes.



121
122
123
# File 'lib/less/engine/nodes/literal.rb', line 121

def quotes
  @quotes
end

Instance Method Details

#to_cssObject



133
134
135
# File 'lib/less/engine/nodes/literal.rb', line 133

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