Class: Less::Node::Property
Instance Attribute Summary collapse
Attributes included from Entity
#parent
Instance Method Summary
collapse
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) ⇒ Property
Returns a new instance of Property.
8
9
10
11
12
|
# File 'lib/less/engine/nodes/property.rb', line 8
def initialize key, value = nil
super key
@value = Expression.new(value ? [value] : [])
@eval = false end
|
Instance Attribute Details
Returns the value of attribute value.
6
7
8
|
# File 'lib/less/engine/nodes/property.rb', line 6
def value
@value
end
|
Instance Method Details
#<<(token) ⇒ Object
14
15
16
17
|
# File 'lib/less/engine/nodes/property.rb', line 14
def << token
token = Node::Anonymous.new(*token) unless token.is_a? Entity or token.is_a? Operator
@value << token
end
|
#empty? ⇒ Boolean
19
|
# File 'lib/less/engine/nodes/property.rb', line 19
def empty?; !@value || @value.empty? end
|
#eval? ⇒ Boolean
20
|
# File 'lib/less/engine/nodes/property.rb', line 20
def eval?; @eval end
|
TODO: @eval and @value should be merged
31
32
33
|
# File 'lib/less/engine/nodes/property.rb', line 31
def evaluate
@eval || @eval = value.evaluate
end
|
22
23
24
|
# File 'lib/less/engine/nodes/property.rb', line 22
def inspect
self + (empty?? "" : ": `#{value.map {|i| i.to_s } * ' | '}`")
end
|
35
36
37
|
# File 'lib/less/engine/nodes/property.rb', line 35
def to_css
"#{self}: #{evaluate.to_css};"
end
|
26
27
28
|
# File 'lib/less/engine/nodes/property.rb', line 26
def to_s
super
end
|