Module: Hallon::Loadable
- Included in:
- Album, AlbumBrowse, Artist, ArtistBrowse, Image, Playlist, PlaylistContainer, Search, Toplist, Track, User, User::Post
- Defined in:
- lib/hallon/loadable.rb
Overview
Extends Hallon objects with a method that allows synchronous loading of objects.
Instance Method Summary collapse
-
#load(timeout = Hallon.load_timeout) ⇒ self
Wait until the object has loaded.
Instance Method Details
#load(timeout = Hallon.load_timeout) ⇒ self
Wait until the object has loaded.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hallon/loadable.rb', line 15 def load(timeout = Hallon.load_timeout) Timeout.timeout(timeout, Hallon::TimeoutError) do until loaded? session.process_events if respond_to?(:status) Error.maybe_raise(status, :ignore => :is_loading) end sleep(0.001) end self end end |