Sha256: cbd50c122982c0a10a2c9533d920dea0496649e3e9e7f8109781525b1728e228
Contents?: true
Size: 638 Bytes
Versions: 24
Compression:
Stored size: 638 Bytes
Contents
# frozen_string_literal: true require_relative "theme_presenter" module Theme module Presenters class ThemesPresenter ORDER_BY_ROLE = %w(live unpublished development) def initialize(ctx, root) @ctx = ctx @root = root end def all all_themes .sort_by { |theme| order_by_role(theme) } .map { |theme| ThemePresenter.new(theme) } end private def order_by_role(theme) ORDER_BY_ROLE.index(theme.role) || ORDER_BY_ROLE.size end def all_themes ShopifyCLI::Theme::Theme.all(@ctx, root: @root) end end end end
Version data entries
24 entries across 24 versions & 1 rubygems