Module: Hallon::Observable::Image

Included in:
Image
Defined in:
lib/hallon/observable/image.rb

Overview

Callbacks related to Image objects.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(other) ⇒ Object

Includes Hallon::Observable for you.



5
6
7
# File 'lib/hallon/observable/image.rb', line 5

def self.extended(other)
  other.send(:include, Hallon::Observable)
end

Instance Method Details

#initialize_callbacksMethod (protected)

Returns load callback.

Returns:

  • (Method)

    load callback



12
13
14
# File 'lib/hallon/observable/image.rb', line 12

def initialize_callbacks
  callback_for(:load)
end

#load_callback(pointer, userdata) { ... } ⇒ Object (protected)

This callback is fired when the Image object is fully loaded.

Examples:

listening to this callback

image = Image.new("spotify:image:3ad93423add99766e02d563605c6e76ed2b0e450")
image.on(:load) do
  puts "Image has loaded"
end

Yields:

  • []



25
26
27
# File 'lib/hallon/observable/image.rb', line 25

def load_callback(pointer, userdata)
  trigger(pointer, :load)
end