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.



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

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

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



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

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#inspectObject



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

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

#perform(environment) ⇒ Object



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

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::EvaluationContext.new(environment.options).send(name, *args)
rescue ArgumentError => e
  raise e unless e.backtrace.first =~ /:in `(#{name}|perform)'$/
  raise Sass::SyntaxError.new("#{e.message} for `#{name}'")
end