Sha256: bfec17d0a58fb60c6a2569298b9c644de52b535299efe4d56099eb46bd794128

Contents?: true

Size: 747 Bytes

Versions: 48

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

require 'delegate'
require_relative '../models/color_theme'
require_relative '../support/color_themable'

module Dsu
  module Presenters
    class BasePresenter < SimpleDelegator
      include Support::ColorThemable

      attr_reader :color_theme

      def initialize(object, options: {})
        super(object)

        @options = options || {}
        theme_name = options.fetch(:theme_name, Models::Configuration.new.theme_name)
        @color_theme = Models::ColorTheme.find(theme_name: theme_name)
      end

      private

      attr_reader :options

      def formatted_index(index:)
        apply_theme("#{format('%02s', index + 1)}. ",
          theme_color: color_theme.index)
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
dsu-3.0.5 lib/dsu/presenters/base_presenter.rb
dsu-3.0.4 lib/dsu/presenters/base_presenter.rb
dsu-3.0.3 lib/dsu/presenters/base_presenter.rb
dsu-3.0.1 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.beta.3 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.beta.2 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.beta.1 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.beta.0 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.12 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.11 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.10 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.9 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.8 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.7 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.6 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.5 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.4 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.3 lib/dsu/presenters/base_presenter.rb
dsu-3.0.0.alpha.2 lib/dsu/presenters/base_presenter.rb