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
#<<, #==, #copy, #empty?, #eql?, #eval?, #nearest, #parent=
Methods included from Entity
#path, #root
Constructor Details
#initialize(key, value = nil, parent = nil) ⇒ Variable
Returns a new instance of Variable.
74
75
76
77
|
# File 'lib/less/engine/nodes/property.rb', line 74
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.
72
73
74
|
# File 'lib/less/engine/nodes/property.rb', line 72
def declaration
@declaration
end
|
Instance Method Details
87
88
89
90
91
92
93
|
# File 'lib/less/engine/nodes/property.rb', line 87
def evaluate
if declaration
@eval ||= value.evaluate
else
@eval ||= self.parent.nearest(to_s).evaluate
end
end
|
79
80
81
|
# File 'lib/less/engine/nodes/property.rb', line 79
def inspect
"@#{super}"
end
|
99
100
101
102
103
104
105
106
|
# File 'lib/less/engine/nodes/property.rb', line 99
def to_css
evaluate
if @eval.respond_to? :to_css
@eval.to_css
else
@eval.map {|i| i.to_css }.join ', '
end
end
|
95
96
97
|
# File 'lib/less/engine/nodes/property.rb', line 95
def to_ruby
evaluate.to_ruby
end
|
83
84
85
|
# File 'lib/less/engine/nodes/property.rb', line 83
def to_s
"@#{super}"
end
|