Class: Less2Sass::Less::Tree::CallNode

Inherits:
Node
  • Object
show all
Defined in:
lib/less2sass/less/tree/call_node.rb

Overview

Represents a function call node. It can be either a CSS or a Less built-in function.

Its Sass equivalent is Sass::Script::Tree::Funcall.

Constant Summary collapse

MISC_FUNCTIONS =

TODO: Map Less built-in functions to Sass built-in functions, null if there is no equivalent

%w(color image-size image-width image-height
convert data-uri default unit get-unit svg-gradient).freeze
STRING_FUNCTIONS =
%w(escape e % replace).freeze
LIST_FUNCTIONS =
%w(length extract).freeze
MATH_FUNCTIONS =
%w(ceil floor percentage round sqrt abs sin
asin cos acos tan atan pi pow mod min max).freeze
TYPE_FUNCTIONS =
%w(isnumber isstring iscolor iskeyword isurl
ispixel isem ispercentage isunit isruleset).freeze
COLOR_DEFINITION_FUNCTIONS =
%w(rgb rgba argb hsl hsla hsv hsva).freeze
COLOR_CHANNEL_FUNCTIONS =
%w(hue saturation lightness hsvhue hsvsaturation
hsvvalue red green blue alpha luma luminance).freeze
COLOR_OPERATION_FUNCTIONS =
%w(saturate desaturate lighten darken fadein
fadeout fade spin mix tint shade greyscale contrast).freeze
COLOR_BLENDING_FUNCTIONS =
%w(multiply screen overlay softlight hardlight
difference exclusion average negation).freeze

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #has_children, #has_parent, #line, #parent, #ref_vars

Instance Method Summary collapse

Methods inherited from Node

#<<, #==, #contains_variables?, #creates_context?, #each, #get_referenced_variable_names, #initialize, #transform

Constructor Details

This class inherits a constructor from Less2Sass::Less::Tree::Node

Instance Attribute Details

#argsObject

Returns the value of attribute args.



10
11
12
# File 'lib/less2sass/less/tree/call_node.rb', line 10

def args
  @args
end

#currentFileInfoObject

Returns the value of attribute currentFileInfo.



12
13
14
# File 'lib/less2sass/less/tree/call_node.rb', line 12

def currentFileInfo
  @currentFileInfo
end

#indexObject

Returns the value of attribute index.



11
12
13
# File 'lib/less2sass/less/tree/call_node.rb', line 11

def index
  @index
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/less2sass/less/tree/call_node.rb', line 9

def name
  @name
end

Instance Method Details

#to_sass::Sass::Script::Tree::Funcall

TODO:

built-in functions should be converted by the mapping if there is no equivalent, a custom conversion should be implemented. If the Hash does not contain the function, most probably, it’s a CSS built-in function and it should be copied as it is.

Note:

In its current version it could output unrecognizable functions by the Sass compiler and/or interpreter.

See Also:



49
50
51
# File 'lib/less2sass/less/tree/call_node.rb', line 49

def to_sass
  node(::Sass::Script::Tree::Funcall.new(@name, get_args, ::Sass::Util::NormalizedMap.new, nil, nil), line)
end