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?, #nearest, #parent=
  
  
  
  
  
  
  
  
  Methods included from Entity
  #path, #root
  
  Constructor Details
  
    
  
  
    #initialize(key, value = nil, parent = nil)  ⇒ Variable 
  
  
  
  
    
Returns a new instance of Variable.
   
 
  
  
    | 
91
92
93
94 | # File 'lib/less/engine/nodes/property.rb', line 91
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.
   
 
  
  
    | 
89
90
91 | # File 'lib/less/engine/nodes/property.rb', line 89
def declaration
  @declaration
end | 
 
    
   
  
    Instance Method Details
    
      
  
  
    #evaluate(env = nil)  ⇒ Object 
  
  
  
  
    | 
104
105
106
107
108
109
110
111
112
113
114
115
116
117 | # File 'lib/less/engine/nodes/property.rb', line 104
def evaluate env = nil
  if declaration
    value.evaluate   else
  begin
    var = (env || self.parent).nearest(to_s)   rescue VariableNameError
    var = self.parent.nearest(to_s)
  end
    var.evaluate
  end
end | 
 
    
      
  
  
    | 
96
97
98 | # File 'lib/less/engine/nodes/property.rb', line 96
def inspect
  "@#{super}"
end | 
 
    
      
  
  
    #to_css(env = nil)  ⇒ Object 
  
  
  
  
    | 
123
124
125
126
127
128
129
130 | # File 'lib/less/engine/nodes/property.rb', line 123
def to_css env = nil
  val = evaluate env
  if val.respond_to? :to_css
    env ? val.to_css(env) : val.to_css
  else
    val.map {|i| env ? i.to_css(env) : i.to_css }.join ', '
  end
end | 
 
    
      
  
  
    | 
119
120
121 | # File 'lib/less/engine/nodes/property.rb', line 119
def to_ruby
  evaluate.to_ruby
end | 
 
    
      
  
  
    | 
100
101
102 | # File 'lib/less/engine/nodes/property.rb', line 100
def to_s
  "@#{super}"
end |