class Celestial::World
- Celestial::World
- Reference
- Object
Overview
Defines the world. A world contains many Vessel
objects, and has a
#timestamp
(in UTC) when it was last touched.
Defined in:
parade/world.crConstructors
- .new(__temp_67 : JSON::PullParser)
-
.new(vessels = [] of Vessel, timestamp = Time.utc_now)
Create a new world.
Instance Method Summary
-
#[](id)
Obtain the vessel with the given ID.
-
#[]?(id)
Obtain the vessel with the given ID, or nil.
-
#delete(id)
Remove a vessel from the world, shifting down all indexes after it and removing references to it.
- #http_delete(id, env)
- #http_get(id, env)
- #http_patch(id, env)
- #http_post(env)
- #index(env)
-
#on_change(&on_change : Hash(Symbol, Int32) -> )
Set the callback for any change to the world.
- #timestamp : Time
- #timestamp=(_timestamp : Time)
- #to_json(json : JSON::Builder)
-
#touch
Set the timestamp to the current UTC time.
- #vessels : Array(Vessel)
- #vessels=(_vessels : Array(Vessel))
Constructor Detail
Instance Method Detail
def delete(id)
#
Remove a vessel from the world, shifting down all indexes after it and removing references to it.
FIXME Make a vessel's children spill into its parent when the vessel is deleted
def on_change(&on_change : Hash(Symbol, Int32) -> )
#
Set the callback for any change to the world.
Example:
world.on_change do |message|
puts message
end