Class: Discorb::Snowflake
- Inherits:
-
DiscordModel
- Object
- DiscordModel
- 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.
-
#to_i -> Integer
Integerize snowflake.
-
#to_s -> String
Stringify snowflake.
Instance Attribute Details
#increment -> Integer (readonly)
Increment of snowflake.
|
# File 'lib/discorb/common.rb', line 48
|
#process_id -> Integer (readonly)
Process ID of snowflake.
|
# File 'lib/discorb/common.rb', line 48
|
#worker_id -> Integer (readonly)
Worker ID of snowflake.
|
# File 'lib/discorb/common.rb', line 48
|
Instance Method Details
#==(other) -> Boolean
Compares snowflake with other object.
92 93 94 95 96 |
# File 'lib/discorb/common.rb', line 92 def ==(other) return false unless other.respond_to?(:to_s) to_s == other.to_s end |
#eql?(other) -> Boolean
Alias of #==.
101 102 103 |
# File 'lib/discorb/common.rb', line 101 def eql?(other) self == other end |
#hash -> Object
Return hash of snowflake.
106 107 108 |
# File 'lib/discorb/common.rb', line 106 def hash to_s.hash end |
#to_i -> Integer
Integerize snowflake.
81 82 83 |
# File 'lib/discorb/common.rb', line 81 def to_i @value.to_i end |
#to_s -> String
Stringify snowflake.
72 73 74 |
# File 'lib/discorb/common.rb', line 72 def to_s @value.to_s end |