Sha256: 648fa15843d6106a57eac3d080dfc7344e1e1741b7c16d60efb5baebd78febb4

Contents?: true

Size: 494 Bytes

Versions: 29

Compression:

Stored size: 494 Bytes

Contents

# frozen_string_literal: true

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

        @statements =
          (parsed.presence || []).map { |statement| Statement.new(statement) }
      end

      def evaluate(**args)
        last = Object::Nothing.new

        (@statements || []).each do |statement|
          last = statement.evaluate(**args.merge(object: Object::Global.new))
        end

        last
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
code-ruby-1.1.3 lib/code/node/code.rb
code-ruby-1.1.1 lib/code/node/code.rb
code-ruby-1.1.0 lib/code/node/code.rb
code-ruby-1.0.0 lib/code/node/code.rb
code-ruby-0.15.16 lib/code/node/code.rb
code-ruby-0.15.15 lib/code/node/code.rb
code-ruby-0.15.14 lib/code/node/code.rb
code-ruby-0.15.13 lib/code/node/code.rb
code-ruby-0.15.12 lib/code/node/code.rb
code-ruby-0.15.11 lib/code/node/code.rb
code-ruby-0.15.10 lib/code/node/code.rb
code-ruby-0.15.9 lib/code/node/code.rb
code-ruby-0.15.8 lib/code/node/code.rb
code-ruby-0.15.7 lib/code/node/code.rb
code-ruby-0.15.6 lib/code/node/code.rb
code-ruby-0.15.5 lib/code/node/code.rb
code-ruby-0.15.4 lib/code/node/code.rb
code-ruby-0.15.3 lib/code/node/code.rb
code-ruby-0.15.2 lib/code/node/code.rb
code-ruby-0.15.0 lib/code/node/code.rb