Class: Less::Node::Variable
Instance Attribute Summary collapse
Attributes inherited from Property
#value
Attributes included from Entity
#parent
Instance Method Summary
collapse
Methods inherited from Property
#<<, #empty?, #eval?, #nearest
Methods included from Entity
#path, #root
Methods inherited from String
#blank?, #column_of, #indent, #line_of, #tabto, #treetop_camelize
Constructor Details
#initialize(key, value = nil, parent = nil) ⇒ Variable
Returns a new instance of Variable.
57
58
59
60
|
# File 'lib/less/engine/nodes/property.rb', line 57
def initialize key, value = nil, parent = nil
@declaration = value ? true : false
super key.delete('@'), value, parent
end
|
Instance Attribute Details
#declaration ⇒ Object
Returns the value of attribute declaration.
55
56
57
|
# File 'lib/less/engine/nodes/property.rb', line 55
def declaration
@declaration
end
|
Instance Method Details
70
71
72
73
74
75
76
|
# File 'lib/less/engine/nodes/property.rb', line 70
def evaluate
if declaration
@eval ||= value.evaluate
else
@eval ||= self.parent.nearest(to_s).evaluate
end
end
|
62
63
64
|
# File 'lib/less/engine/nodes/property.rb', line 62
def inspect
"@#{super}"
end
|
82
83
84
|
# File 'lib/less/engine/nodes/property.rb', line 82
def to_css
evaluate.to_css
end
|
78
79
80
|
# File 'lib/less/engine/nodes/property.rb', line 78
def to_ruby
evaluate.to_ruby
end
|
66
67
68
|
# File 'lib/less/engine/nodes/property.rb', line 66
def to_s
"@#{super}"
end
|