Class: Godot::Variant::AbstractArray
Direct Known Subclasses
Array
Constant Summary
VARIANT_TYPE
Constants included
from Godot
Godot::VERSION
Class Method Summary
collapse
Instance Method Summary
collapse
#get, #key?, #method_missing, #respond_to_missing?, #set, #to_godot
Methods included from Godot
init_level
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Godot::Variant
Class Method Details
.[](*elems) ⇒ Object
37
|
# File 'lib/godot_rb/enumerable.rb', line 37
def self.[](*elems) = from(elems)
|
.from(enum) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/godot_rb/enumerable.rb', line 26
def self.from(enum)
array = new
size = enum.lazy.size
if size
array.resize(size)
enum.each_with_index {|elem, index| array[index] = elem }
else
enum.each { array.push_back = _1 }
end
array
end
|
Instance Method Details
#each(&blk) ⇒ Object
39
40
41
42
43
|
# File 'lib/godot_rb/enumerable.rb', line 39
def each(&blk)
return to_enum { size } unless blk
size.times { blk.(self[_1]) }
self
end
|