Sha256: 1f6469b7e88d7e0786fcfcb090aa68813c8e4e0aa358a2f9582a29c64e99c334

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents

require 'gobstones/lang/definitions/definition_call'
require 'gobstones/runner/errors/definition_not_found_error'

module Gobstones

  module Lang

    class ProcedureCall

      include DefinitionCall

      def evaluate(context)
        evaluated_args = args.map { |arg| arg.evaluate context }
        context.program_context.definition_named(name, ->(definition) {
          definition.evaluate context, evaluated_args
        }, -> { raise Gobstones::Runner::DefinitionNotFound.new name } )
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gobstones-0.0.1.1 lib/gobstones/lang/commands/procedure_call.rb