String
# File lib/less/engine/nodes/property.rb, line 8
8: def initialize key, value = nil, parent = nil
9: super key, parent
10: value = if value.is_a? Array
11: value.each {|v| v.parent = self if v.respond_to? :parent }.
12: map {|v| v.is_a?(Expression) ? v : Expression.new(v, self) }
13: elsif value.nil?
14: []
15: else
16: value
17: end
18: @value = value.is_a?(Expression) ? value : Expression.new(value, self)
19: @value.parent = self
20: @value.delimiter = ','
21: # puts "new property #{to_s}: #{value} => #{@value}, contains: #{@value[0].class}"
22: # puts
23: end
# File lib/less/engine/nodes/property.rb, line 34
34: def << token
35: token = Node::Anonymous.new(*token) unless token.is_a? Entity or token.respond_to? :to_ruby
36: token.parent = self if token.respond_to? :parent
37: @value << token
38: end
# File lib/less/engine/nodes/property.rb, line 46
46: def == other
47: self.to_s == other.to_s
48: end
# File lib/less/engine/nodes/property.rb, line 30
30: def copy
31: clone.tap {|c| c.value = value.copy }
32: end
# File lib/less/engine/nodes/property.rb, line 40
40: def empty?; !@value || @value.empty? end
# File lib/less/engine/nodes/property.rb, line 50
50: def eql? other
51: self == other and value.eql? other.value
52: end
# File lib/less/engine/nodes/property.rb, line 62
62: def evaluate env = nil
63: # puts "evaluating property `#{to_s}`: #{value.inspect}"
64: if value.is_a?(Expression) #Value
65: # puts "value is a Value"
66: value.map {|e| e.evaluate(env) } #6
67: else
68: # puts "value is a #{value.class}"
69: [value.evaluate(env)]
70: end
71:
72:
73: end
# File lib/less/engine/nodes/property.rb, line 42
42: def inspect
43: self + (empty?? "" : ": `#{value.map {|i| i.to_s } * ' | '}`")
44: end
# File lib/less/engine/nodes/property.rb, line 58
58: def nearest node
59: parent.nearest node
60: end
# File lib/less/engine/nodes/property.rb, line 25
25: def parent= obj
26: @parent = obj
27: value.parent = self
28: end
# File lib/less/engine/nodes/property.rb, line 75
75: def to_css env = nil
76: # puts "property.to_css `#{to_s}` env:#{env ? env.variables : "nil"}"
77: val = evaluate(env)
78: "#{self}: #{if val.respond_to? :to_css
79: val.to_css
80: else
81: # p val
82: # puts "#{val.class} #{val.first.class}"
83: val.map {|i| i.to_css }.join(", ")
84: end};"
85: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.