Class: Discorb::Shard
- Inherits:
-
Object
- Object
- Discorb::Shard
- Defined in:
- lib/discorb/shard.rb
Overview
Represents a shard.
Instance Attribute Summary collapse
-
#id -> Integer
readonly
The ID of the shard.
-
#logger -> Logger
readonly
The logger of the shard.
-
#thread -> Thread
readonly
The thread of the shard.
Instance Method Summary collapse
-
#close! -> void
Stops the shard.
- #inspect -> Object
-
#start -> void
Starts the shard.
Instance Attribute Details
#id -> Integer (readonly)
Returns The ID of the shard.
9 10 11 |
# File 'lib/discorb/shard.rb', line 9 def id @id end |
#logger -> Logger (readonly)
Returns The logger of the shard.
13 14 15 |
# File 'lib/discorb/shard.rb', line 13 def logger @logger end |
#thread -> Thread (readonly)
Returns The thread of the shard.
11 12 13 |
# File 'lib/discorb/shard.rb', line 11 def thread @thread end |
Instance Method Details
#close! -> void
This method returns an undefined value.
Stops the shard.
64 65 66 67 68 |
# File 'lib/discorb/shard.rb', line 64 def close! @status = :closed @main_task&.stop @thread.kill end |
#inspect -> Object
70 71 72 |
# File 'lib/discorb/shard.rb', line 70 def inspect "#<#{self.class} #{id}/#{@shard_count} #{@status}>" end |
#start -> void
This method returns an undefined value.
Starts the shard.
55 56 57 |
# File 'lib/discorb/shard.rb', line 55 def start @thread.wakeup end |