Class: Sass::Tree::FunctionNode
- Inherits:
-  Node - Object
- Node
- Sass::Tree::FunctionNode
 
- Defined in:
- /Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/function_node.rb
Overview
A dynamic node representing a function definition.
Instance Attribute Summary (collapse)
-   - (Array<Script::Tree::Node>) args   The arguments to the function. 
-   - (String) name   readonly The name of the function. 
-   - (Script::Tree::Node?) splat   The splat argument for this function, if one exists. 
Attributes inherited from Node
#children, #filename, #has_children, #line, #options, #source_range
Instance Method Summary (collapse)
-   - (FunctionNode) initialize(name, args, splat)   constructor A new instance of FunctionNode. 
-   - (String) normalized_name   Strips out any vendor prefixes. 
Methods inherited from Node
#<<, #==, #balance, #bubbles?, #css, #css_with_sourcemap, #deep_copy, #each, #inspect, #invisible?, #style, #to_sass, #to_scss
Constructor Details
- (FunctionNode) initialize(name, args, splat)
Returns a new instance of FunctionNode
| 33 34 35 36 37 38 39 40 41 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/function_node.rb', line 33
def initialize(name, args, splat)
  @name = name
  @args = args
  @splat = splat
  super()
  return unless %w(and or not).include?(name)
  raise Sass::SyntaxError.new("Invalid function name \"#{name}\".")
end | 
Instance Attribute Details
- (Array<Script::Tree::Node>) args
The arguments to the function. Each element is a tuple containing the variable for argument and the parse tree for the default value of the argument
| 16 17 18 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/function_node.rb', line 16
def args
  @args
end | 
- (String) name (readonly)
The name of the function.
| 9 10 11 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/function_node.rb', line 9
def name
  @name
end | 
- (Script::Tree::Node?) splat
The splat argument for this function, if one exists.
| 21 22 23 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/function_node.rb', line 21
def splat
  @splat
end | 
Instance Method Details
- (String) normalized_name
Strips out any vendor prefixes.
| 25 26 27 | # File '/Users/ceppstei/Projects/sass-lang/.sass/lib/sass/tree/function_node.rb', line 25
def normalized_name
  @normalized_name ||= name.gsub(/^(?:-[a-zA-Z0-9]+-)?/, '\1')
end |