Class: Less::Node::Function

Inherits:
String
  • Object
show all
Includes:
Functions, Entity
Defined in:
lib/less/engine/nodes/function.rb

Instance Attribute Summary

Attributes included from Entity

#parent

Instance Method Summary collapse

Methods included from Entity

#inspect, #path, #root, #to_s

Methods included from Functions

#hsl, #hsla, #rgb, #rgba

Constructor Details

#initialize(name, *args) ⇒ Function

Returns a new instance of Function.



43
44
45
46
# File 'lib/less/engine/nodes/function.rb', line 43

def initialize name, *args
  @args = args.flatten
  super name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



56
57
58
# File 'lib/less/engine/nodes/function.rb', line 56

def method_missing meth, *args
  Node::Anonymous.new("#{meth}(#{args.map(&:to_css) * ', '})")
end

Instance Method Details

#evaluateObject



52
53
54
# File 'lib/less/engine/nodes/function.rb', line 52

def evaluate
  send self.to_sym, *@args
end

#to_cssObject



48
49
50
# File 'lib/less/engine/nodes/function.rb', line 48

def to_css
  self.evaluate.to_css
end