Class: Theme::Presenters::ThemesPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/project_types/theme/presenters/themes_presenter.rb

Constant Summary collapse

SUPPORTED_ROLES =
%w(live unpublished development)

Instance Method Summary collapse

Constructor Details

#initialize(ctx, root) ⇒ ThemesPresenter

Returns a new instance of ThemesPresenter.



10
11
12
13
# File 'lib/project_types/theme/presenters/themes_presenter.rb', line 10

def initialize(ctx, root)
  @ctx = ctx
  @root = root
end

Instance Method Details

#allObject



15
16
17
18
19
20
# File 'lib/project_types/theme/presenters/themes_presenter.rb', line 15

def all
  all_themes
    .select { |theme| SUPPORTED_ROLES.include?(theme.role) }
    .sort_by { |theme| SUPPORTED_ROLES.index(theme.role) }
    .map { |theme| ThemePresenter.new(theme) }
end