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?, #eql?, #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.
65
66
67
68
|
# File 'lib/less/engine/nodes/property.rb', line 65
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.
63
64
65
|
# File 'lib/less/engine/nodes/property.rb', line 63
def declaration
@declaration
end
|
Instance Method Details
78
79
80
81
82
83
84
|
# File 'lib/less/engine/nodes/property.rb', line 78
def evaluate
if declaration
@eval ||= value.evaluate
else
@eval ||= self.parent.nearest(to_s).evaluate
end
end
|
70
71
72
|
# File 'lib/less/engine/nodes/property.rb', line 70
def inspect
"@#{super}"
end
|
90
91
92
|
# File 'lib/less/engine/nodes/property.rb', line 90
def to_css
evaluate.to_css
end
|
86
87
88
|
# File 'lib/less/engine/nodes/property.rb', line 86
def to_ruby
evaluate.to_ruby
end
|
74
75
76
|
# File 'lib/less/engine/nodes/property.rb', line 74
def to_s
"@#{super}"
end
|