Class: RubyCord::Client::Gateway::Shard

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycord/client/gateway/shard.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idInteger (readonly)

Returns The ID of the shard.

Returns:

  • (Integer)

    The ID of the shard.



12
13
14
# File 'lib/rubycord/client/gateway/shard.rb', line 12

def id
  @id
end

#loggerLogger (readonly)

Returns The logger of the shard.

Returns:

  • (Logger)

    The logger of the shard.



16
17
18
# File 'lib/rubycord/client/gateway/shard.rb', line 16

def logger
  @logger
end

#threadThread (readonly)

Returns The thread of the shard.

Returns:

  • (Thread)

    The thread of the shard.



14
15
16
# File 'lib/rubycord/client/gateway/shard.rb', line 14

def thread
  @thread
end

Instance Method Details

#closevoid

This method returns an undefined value.

Stops the shard.



69
70
71
72
73
# File 'lib/rubycord/client/gateway/shard.rb', line 69

def close
  @status = :closed
  @main_task&.stop
  @thread.kill
end

#inspectString

Returns Object class and attributes.

Returns:

  • (String)

    Object class and attributes.



76
77
78
# File 'lib/rubycord/client/gateway/shard.rb', line 76

def inspect
  "#<#{self.class} #{id}/#{@shard_count} #{@status}>"
end

#startvoid

This method returns an undefined value.

Starts the shard.



60
61
62
# File 'lib/rubycord/client/gateway/shard.rb', line 60

def start
  @thread.wakeup
end