Sha256: ebd2394da8557fcb124197d9ffe3f7c3de014677f0cc873add9877f30bf4c2c5

Contents?: true

Size: 401 Bytes

Versions: 3

Compression:

Stored size: 401 Bytes

Contents

# frozen_string_literal: true

require_relative 'statement'

module Basic101

  class DefineFunctionStatement < Statement

    def initialize(identifier, parameters, expression)
      @function = UserDefinedFunction.new(identifier, parameters, expression)
    end

    def execute(runtime)
      runtime.add_function @function
    end

    protected

    def state
      @function
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

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