Class: Sass::Script::Funcall

Inherits:
Object
  • Object
show all
Defined in:
lib/sass/script/funcall.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, args) ⇒ Funcall

Returns a new instance of Funcall.



6
7
8
9
# File 'lib/sass/script/funcall.rb', line 6

def initialize(name, args)
  @name = name
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



4
5
6
# File 'lib/sass/script/funcall.rb', line 4

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/sass/script/funcall.rb', line 4

def name
  @name
end

Instance Method Details

#inspectObject



11
12
13
# File 'lib/sass/script/funcall.rb', line 11

def inspect
  "#{name}(#{args.map {|a| a.inspect}.join(', ')})"
end

#perform(environment) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sass/script/funcall.rb', line 15

def perform(environment)
  args = self.args.map {|a| a.perform(environment)}
  unless Haml::Util.has?(:public_instance_method, Functions, name) && name !~ /^__/
    return Script::String.new("#{name}(#{args.map {|a| a.perform(environment)}.join(', ')})")
  end

  return Functions.send(name, *args)
rescue ArgumentError => e
  raise e unless e.backtrace.first =~ /:in `(#{name}|perform)'$/
  raise Sass::SyntaxError.new("#{e.message} for `#{name}'")
end