Module: WeebSh::IDObject

Included in:
PreviewImage
Defined in:
lib/weeb/data.rb

Overview

Mixin for objects with IDs

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idString (readonly) Also known as: resolve_id, hash

Returns the ID which uniquely identifies this object in toph.

Returns:

  • (String)

    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