Class: Ejaydj::Dj

Inherits:
Object
  • Object
show all
Includes:
Mixins
Defined in:
lib/ejaydj/dj.rb

Direct Known Subclasses

Ejaydj::Djs::TwitterBot

Constant Summary collapse

PLAYLIST_SCHEDULE =
{
  600..1159   => :morning_playlists,      # 6AM  - 12PM
  1200..1759  => :noon_playlists,         # 12PM - 5:59PM
  1800..2259  => :night_playlists,        # 6PM  - 10:59PM
  2300..2359  => :late_night_playlists,   # 11PM - 11:59AM
  0..559      => :late_night_playlists    # 12AM - 5:59AM
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) {|_self| ... } ⇒ Dj

Returns a new instance of Dj.

Yields:

  • (_self)

Yield Parameters:

  • _self (Ejaydj::Dj)

    the object that the method was called on



26
27
28
29
# File 'lib/ejaydj/dj.rb', line 26

def initialize(attributes={})
  instantiate_variables_from attributes
  yield self if block_given?
end

Instance Attribute Details

#late_night_playlistsObject

Returns the value of attribute late_night_playlists.



17
18
19
# File 'lib/ejaydj/dj.rb', line 17

def late_night_playlists
  @late_night_playlists
end

#morning_playlistsObject

Returns the value of attribute morning_playlists.



17
18
19
# File 'lib/ejaydj/dj.rb', line 17

def morning_playlists
  @morning_playlists
end

#music_client=(value) ⇒ Object

Sets the attribute music_client

Parameters:

  • value

    the value to set the attribute music_client to.



17
18
19
# File 'lib/ejaydj/dj.rb', line 17

def music_client=(value)
  @music_client = value
end

#music_client_idObject

Returns the value of attribute music_client_id.



17
18
19
# File 'lib/ejaydj/dj.rb', line 17

def music_client_id
  @music_client_id
end

#music_client_secretObject

Returns the value of attribute music_client_secret.



17
18
19
# File 'lib/ejaydj/dj.rb', line 17

def music_client_secret
  @music_client_secret
end

#music_user_idObject

Returns the value of attribute music_user_id.



17
18
19
# File 'lib/ejaydj/dj.rb', line 17

def music_user_id
  @music_user_id
end

#night_playlistsObject

Returns the value of attribute night_playlists.



17
18
19
# File 'lib/ejaydj/dj.rb', line 17

def night_playlists
  @night_playlists
end

#noon_playlistsObject

Returns the value of attribute noon_playlists.



17
18
19
# File 'lib/ejaydj/dj.rb', line 17

def noon_playlists
  @noon_playlists
end

Instance Method Details

#play_me_a_song(time: Time.now) ⇒ Object



31
32
33
# File 'lib/ejaydj/dj.rb', line 31

def play_me_a_song(time: Time.now)
  current_playlist(time).next_track
end

#playlistsObject



35
36
37
# File 'lib/ejaydj/dj.rb', line 35

def playlists
  @playlists ||= all_playlists
end

#reload!Object



39
40
41
42
# File 'lib/ejaydj/dj.rb', line 39

def reload!
  @playlists = all_playlists
  @playlists.each(&:reload!)
end