Class: ItemsPageFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/etvnet_seek/core/items_page_factory.rb

Class Method Summary collapse

Class Method Details

.create(mode, params = []) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/etvnet_seek/core/items_page_factory.rb', line 14

def self.create mode, params = []
  url = (mode == 'search') ? nil : (params.class == String ? params : params[0])

  case mode
    when 'main' then
      page = HomePage.new
    when 'channels' then
      page = ChannelsPage.new
    when 'catalog' then
      page = CatalogPage.new
    when 'media' then
      page = MediaPage.new url
    when 'search' then
      page = SearchPage.new *params
    when 'best_hundred' then
      page = BestHundredPage.new
    when 'top_this_week' then
      page = TopThisWeekPage.new
    when 'premiere' then
      page = PremierePage.new
    when 'new_items' then
      page = NewItemsPage.new
    when 'audio' then
      page = AudioPage.new url
    when 'radio' then
      page = RadioPage.new
    else
      page = nil
  end

  page
end