Class: Code::Node::List
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::List
- Defined in:
- lib/code/node/list.rb
Instance Method Summary collapse
- #evaluate(**args) ⇒ Object
-
#initialize(parsed) ⇒ List
constructor
A new instance of List.
Methods inherited from Code::Node
Constructor Details
Instance Method Details
#evaluate(**args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/code/node/list.rb', line 13 def evaluate(**args) list = ::Code::Object::List.new( (@elements || []).map { |element| element.evaluate(**args) } ) constructor = literal_constructor(args.fetch(:context), "List") return list unless constructor if Array(args[:constructing_literal_classes]).include?( ::Code::Object::List ) return list end constructor.call( **args, constructing_literal_classes: Array(args[:constructing_literal_classes]) + [::Code::Object::List], operator: nil, arguments: ::Code::Object::List.new([list]), explicit_arguments: true ) end |