Class: Discorb::Snowflake
- Inherits:
-
String
- Object
- String
- Discorb::Snowflake
- Defined in:
- lib/discorb/common.rb
Overview
Represents Snowflake of Discord.
Instance Attribute Summary collapse
-
#increment -> Integer
readonly
Increment of snowflake.
-
#process_id -> Integer
readonly
Process ID of snowflake.
-
#timestamp -> Time
readonly
Timestamp of snowflake.
-
#worker_id -> Integer
readonly
Worker ID of snowflake.
Instance Method Summary collapse
-
#==(other) -> Boolean
Compares snowflake with other object.
-
#eql?(other) -> Boolean
Alias of #==.
-
#hash -> Object
Return hash of snowflake.
- #inspect -> Object
Instance Attribute Details
#increment -> Integer (readonly)
Increment of snowflake.
|
# File 'lib/discorb/common.rb', line 56
|
#process_id -> Integer (readonly)
Process ID of snowflake.
|
# File 'lib/discorb/common.rb', line 56
|
#worker_id -> Integer (readonly)
Worker ID of snowflake.
|
# File 'lib/discorb/common.rb', line 56
|
Instance Method Details
#==(other) -> Boolean
Compares snowflake with other object.
86 87 88 89 90 |
# File 'lib/discorb/common.rb', line 86 def ==(other) return false unless other.respond_to?(:to_s) to_s == other.to_s end |
#eql?(other) -> Boolean
Alias of #==.
95 96 97 |
# File 'lib/discorb/common.rb', line 95 def eql?(other) self == other end |
#hash -> Object
Return hash of snowflake.
100 101 102 |
# File 'lib/discorb/common.rb', line 100 def hash to_s.hash end |
#inspect -> Object
120 121 122 |
# File 'lib/discorb/common.rb', line 120 def inspect "#<#{self.class} #{self}>" end |