struct
Godot::GroupQuery
- Godot::GroupQuery
- Struct
- Value
- Object
Overview
============================================================================= Fluent Group Query DSL
Zero-allocation stack struct providing clean, chainable group queries:
# 1. Iterate with typed receiver:
group(:enemies).each(as: Enemy) do |enemy|
enemy.take_damage(50)
end
# 2. Collect as typed or untyped array:
enemies = group(:enemies).to_a(as: Enemy)
# 3. Fetch first member:
boss = group(:boss).first(as: Boss)
# 4. Broadcast / call_group:
group(:enemies).call("alert", player.global_position)
# 5. Metrics and predicates:
count = group(:loot).size
is_empty = group(:enemies).empty?
Defined in:
libgodot/extensions/query.crConstructors
Instance Method Summary
-
#any? : Bool
Returns true if the group contains any nodes
-
#call(method_name : String | Symbol, *args) : Void
Broadcasts a method call with optional arguments to every node in the group
-
#each(as type : T.class, &block : T -> Void) : Void forall T
Iterates through each node in this group cast to type T
-
#each(&block : Godot::Node -> Void) : Void
Iterates through each node in this group as Godot::Node
-
#empty? : Bool
Returns true if the group contains no nodes
-
#first(as type : T.class) : T | Nil forall T
Returns the first node in this group cast to type T, or nil if none found
-
#first : Godot::Node | Nil
Returns the first node in this group as Godot::Node, or nil if none found
-
#first!(as type : T.class) : T forall T
Returns the first node in this group cast to type T, raising NodeNotFoundError if none found
-
#first! : Godot::Node
Returns the first node in this group as Godot::Node, raising NodeNotFoundError if none found
-
#first?(as type : T.class) : T | Nil forall T
Returns the first node in this group cast to type T, or nil if none found
-
#first? : Godot::Node | Nil
Returns the first node in this group as Godot::Node, or nil if none found
- #name : String
- #node : Node | Nil
-
#size : Int32
Returns the count of nodes in this group
-
#to_a(as type : T.class) : Array(T) forall T
Returns all nodes in this group cast to type T
-
#to_a : Array(Godot::Node)
Returns all nodes in this group as Array(Godot::Node)
Instance methods inherited from class Object
try?(&)try? try?
Constructor Detail
Instance Method Detail
Broadcasts a method call with optional arguments to every node in the group
Iterates through each node in this group cast to type T
Iterates through each node in this group as Godot::Node
Returns the first node in this group cast to type T, or nil if none found
Returns the first node in this group as Godot::Node, or nil if none found
Returns the first node in this group cast to type T, raising NodeNotFoundError if none found
Returns the first node in this group as Godot::Node, raising NodeNotFoundError if none found
Returns the first node in this group cast to type T, or nil if none found
Returns the first node in this group as Godot::Node, or nil if none found