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.
66 67 68 69 70 |
# File 'lib/discorb/shard.rb', line 66 def close @status = :closed @main_task&.stop @thread.kill end |
#inspect -> Object
72 73 74 |
# File 'lib/discorb/shard.rb', line 72 def inspect "#<#{self.class} #{id}/#{@shard_count} #{@status}>" end |
#start -> void
This method returns an undefined value.
Starts the shard.
57 58 59 |
# File 'lib/discorb/shard.rb', line 57 def start @thread.wakeup end |