Sha256: e910ccda905b2ccd3ea2634bd1ee27c2508990861957c4d496542743d1c9777b

Contents?: true

Size: 513 Bytes

Versions: 3

Compression:

Stored size: 513 Bytes

Contents

# frozen_string_literal: true

module Basic101

  class FunctionCall

    include Identity

    def initialize(identifier, arguments)
      @identifier = identifier
      @arguments = arguments
    end

    def eval(runtime)
      runtime.call_function(@identifier, argument_values(runtime))
    end

    protected

    def state
      [@identifier, @arguments]
    end

    private

    def argument_values(runtime)
      @arguments.map do |argument|
        argument.eval(runtime)
      end
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
basic101-1.0.2 lib/basic101/function_call.rb
basic101-1.0.1 lib/basic101/function_call.rb
basic101-1.0.0 lib/basic101/function_call.rb