Sha256: 69d6e1bce6295fd967b0a154f0bd4128d0d01874e18172e7563549c69a2cd979

Contents?: true

Size: 892 Bytes

Versions: 23

Compression:

Stored size: 892 Bytes

Contents

require File.join(File.dirname(__FILE__), 'functions')
module Sass
  module Script
    class Funcall # :nodoc:
      attr_reader :name, :args

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

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

      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
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
gohanlonllc-haml-2.1.0.20080513000000 lib/sass/script/funcall.rb
gohanlonllc-haml-2.1.0 lib/sass/script/funcall.rb
haml-edge-2.1.1 lib/sass/script/funcall.rb
haml-edge-2.1.10 lib/sass/script/funcall.rb
haml-edge-2.1.11 lib/sass/script/funcall.rb
haml-edge-2.1.12 lib/sass/script/funcall.rb
haml-edge-2.1.5 lib/sass/script/funcall.rb
haml-edge-2.1.13 lib/sass/script/funcall.rb
haml-edge-2.1.14 lib/sass/script/funcall.rb
haml-edge-2.1.15 lib/sass/script/funcall.rb
haml-edge-2.1.17 lib/sass/script/funcall.rb
haml-edge-2.1.18 lib/sass/script/funcall.rb
haml-edge-2.1.19 lib/sass/script/funcall.rb
haml-edge-2.1.2 lib/sass/script/funcall.rb
haml-edge-2.1.20 lib/sass/script/funcall.rb
haml-edge-2.1.21 lib/sass/script/funcall.rb
haml-edge-2.1.3 lib/sass/script/funcall.rb
haml-edge-2.1.4 lib/sass/script/funcall.rb
haml-edge-2.1.16 lib/sass/script/funcall.rb
haml-edge-2.1.7 lib/sass/script/funcall.rb