Class: Dsu::Presenters::ConfigurationPresenter

Inherits:
BasePresenter
  • Object
show all
Defined in:
lib/dsu/presenters/configuration_presenter.rb

Instance Attribute Summary collapse

Attributes inherited from BasePresenter

#color_theme

Instance Method Summary collapse

Methods included from Support::ColorThemable

apply_theme, #prompt_with_options

Constructor Details

#initialize(config, options: {}) ⇒ ConfigurationPresenter

Returns a new instance of ConfigurationPresenter.



12
13
14
15
16
# File 'lib/dsu/presenters/configuration_presenter.rb', line 12

def initialize(config, options: {})
  super

  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/dsu/presenters/configuration_presenter.rb', line 10

def config
  @config
end

Instance Method Details

#configuration_detailsObject



23
24
25
26
27
# File 'lib/dsu/presenters/configuration_presenter.rb', line 23

def configuration_details
  to_h.each_with_index.filter_map do |config_entry, index|
    formatted_config_entry_with_index(config_entry, index: index, theme_color: color_theme.body)
  end
end

#configuration_headerObject



18
19
20
21
# File 'lib/dsu/presenters/configuration_presenter.rb', line 18

def configuration_header
  header = I18n.t('presenters.configuration_presenter.headers.file_contents', config_path: config_path)
  apply_theme(header, theme_color: color_theme.header)
end