Class: Code::Node::Code

Inherits:
Code::Node show all
Defined in:
lib/code/node/code.rb

Instance Method Summary collapse

Constructor Details

#initialize(statements) ⇒ Code

Returns a new instance of Code.



4
5
6
7
8
9
# File 'lib/code/node/code.rb', line 4

def initialize(statements)
  statements = [] if statements.to_s.blank?

  @statements =
    statements.map { |statement| ::Code::Node::Statement.new(statement) }
end

Instance Method Details

#evaluate(**args) ⇒ Object



11
12
13
# File 'lib/code/node/code.rb', line 11

def evaluate(**args)
  @statements.map { |statement| statement.evaluate(**args) }.last
end