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) ⇒ Variable
Returns a new instance of Variable.
48
49
50
51
|
# File 'lib/less/engine/nodes/property.rb', line 48
def initialize key, value = nil
@declaration = value ? true : false
super key.delete('@'), value
end
|
Instance Attribute Details
#declaration ⇒ Object
Returns the value of attribute declaration.
46
47
48
|
# File 'lib/less/engine/nodes/property.rb', line 46
def declaration
@declaration
end
|
Instance Method Details
61
62
63
64
65
66
67
|
# File 'lib/less/engine/nodes/property.rb', line 61
def evaluate
if declaration
@eval ||= value.evaluate
else
@eval ||= self.parent.nearest(to_s).evaluate
end
end
|
53
54
55
|
# File 'lib/less/engine/nodes/property.rb', line 53
def inspect
"@#{super}"
end
|
73
74
75
|
# File 'lib/less/engine/nodes/property.rb', line 73
def to_css
evaluate.to_css
end
|
69
70
71
|
# File 'lib/less/engine/nodes/property.rb', line 69
def to_ruby
evaluate.to_ruby
end
|
57
58
59
|
# File 'lib/less/engine/nodes/property.rb', line 57
def to_s
"@#{super}"
end
|