Sha256: 4e08588281d2520d0c53e05e13c2ae68c5add4df1f75671b8c61033dd0df7b2d

Contents?: true

Size: 427 Bytes

Versions: 12

Compression:

Stored size: 427 Bytes

Contents

class Code
  class Node
    class Block < Node
      def initialize(block)
        @body = ::Code::Node::Code.new(block.fetch(:body))
        @arguments = block.fetch(:arguments, [])
        @arguments.map! do |argument|
          ::Code::Node::FunctionArgument.new(argument)
        end
      end

      def evaluate(**args)
        ::Code::Object::Function.new(arguments: @arguments, body: @body)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
template-ruby-0.4.0 lib/code/node/block.rb
code-ruby-0.4.0 lib/code/node/block.rb
template-ruby-0.3.1 lib/code/node/block.rb
code-ruby-0.3.1 lib/code/node/block.rb
template-ruby-0.3.0 lib/code/node/block.rb
code-ruby-0.3.0 lib/code/node/block.rb
code-ruby-0.2.4 lib/code/node/block.rb
template-ruby-0.2.4 lib/code/node/block.rb
template-ruby-0.2.3 lib/code/node/block.rb
template-ruby-0.2.2 lib/code/node/block.rb
template-ruby-0.2.1 lib/code/node/block.rb
template-ruby-0.2.0 lib/code/node/block.rb