Module: WeebSh::IDObject
- Included in:
- PreviewImage
- Defined in:
- lib/weeb/data.rb
Overview
Mixin for objects with IDs
Instance Attribute Summary collapse
-
#id ⇒ String
(also: #resolve_id, #hash)
readonly
The ID which uniquely identifies this object in toph.
Instance Method Summary collapse
-
#==(other) ⇒ Object
ID based comparison.
Instance Attribute Details
#id ⇒ String (readonly) Also known as: resolve_id, hash
Returns the ID which uniquely identifies this object in toph.
7 8 9 |
# File 'lib/weeb/data.rb', line 7 def id @id end |
Instance Method Details
#==(other) ⇒ Object
ID based comparison
12 13 14 |
# File 'lib/weeb/data.rb', line 12 def ==(other) other.respond_to?(:resolve_id) ? (@id.resolve_id == other.resolve_id) : (@id == other) end |