Sha256: ea2f4f010dcc3ab8fcb3bb21ebd634aa5935445a49cc8334e325b9619302ef25

Contents?: true

Size: 416 Bytes

Versions: 29

Compression:

Stored size: 416 Bytes

Contents

# frozen_string_literal: true

class Code
  class Node
    class List < Node
      def initialize(parsed)
        return if parsed.blank?

        @elements =
          (parsed.presence || []).map { |element| Node::Code.new(element) }
      end

      def evaluate(**args)
        ::Code::Object::List.new(
          (@elements || []).map { |element| element.evaluate(**args) }
        )
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
code-ruby-0.14.9 lib/code/node/list.rb
code-ruby-0.14.8 lib/code/node/list.rb
code-ruby-0.14.6 lib/code/node/list.rb
code-ruby-0.14.5 lib/code/node/list.rb
code-ruby-0.14.4 lib/code/node/list.rb
code-ruby-0.14.3 lib/code/node/list.rb
code-ruby-0.14.2 lib/code/node/list.rb
code-ruby-0.14.1 lib/code/node/list.rb
code-ruby-0.14.0 lib/code/node/list.rb