Class: Ektoplayer::Models::Browser::BrowserRoot

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ektoplayer/models/browser.rb

Constant Summary collapse

CONTENTS =
PATHS.keys.freeze

Instance Method Summary collapse

Constructor Details

#initialize(database) ⇒ BrowserRoot

Returns a new instance of BrowserRoot.



111
112
113
# File 'lib/ektoplayer/models/browser.rb', line 111

def initialize(database)
   @database = database
end

Instance Method Details

#[](*args) ⇒ Object



108
# File 'lib/ektoplayer/models/browser.rb', line 108

def [](*args)     CONTENTS[*args]        end

#each(&block) ⇒ Object



107
# File 'lib/ektoplayer/models/browser.rb', line 107

def each(&block)  CONTENTS.each(&block)  end

#empty?Boolean

Returns:

  • (Boolean)


109
# File 'lib/ektoplayer/models/browser.rb', line 109

def empty?;       CONTENTS.empty?        end

#enter(index) ⇒ Object



117
118
119
120
# File 'lib/ektoplayer/models/browser.rb', line 117

def enter(index)
   fail unless path = PATHS[CONTENTS[index]]
   BrowsableCollection.new(@database, [], path.dup)
end

#reloadObject



115
# File 'lib/ektoplayer/models/browser.rb', line 115

def reload; end

#tracks(index) ⇒ Object



122
123
124
# File 'lib/ektoplayer/models/browser.rb', line 122

def tracks(index)
   @database.select(order_by: 'album,' + CONTENTS[index].to_s + ',album,number')
end