Sha256: 3c0b8ef4663ac8ff34aa2d22c7ed9c48a719a1af237264d87c983a4b9f174ba8

Contents?: true

Size: 453 Bytes

Versions: 3

Compression:

Stored size: 453 Bytes

Contents

# frozen_string_literal: true

class Code
  class Node
    class Function < Node
      def initialize(parsed)
        return if parsed.blank?
        @parameters = parsed.delete(:parameters).presence || []
        @parameters.map! { |parameter| FunctionParameter.new(parameter) }

        @body = Code.new(parsed.delete(:body).presence)
      end

      def evaluate(**_args)
        Object::Function.new(@parameters, @body)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
code-ruby-0.13.1 lib/code/node/function.rb
code-ruby-0.13.0 lib/code/node/function.rb
code-ruby-0.12.0 lib/code/node/function.rb