Class: Dsu::Views::BaseListView

Inherits:
Object
  • Object
show all
Includes:
Support::ColorThemable
Defined in:
lib/dsu/views/base_list_view.rb

Direct Known Subclasses

Project::List

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::ColorThemable

apply_theme, #prompt_with_options

Constructor Details

#initialize(presenter:, options: {}) ⇒ BaseListView

Returns a new instance of BaseListView.



14
15
16
17
18
# File 'lib/dsu/views/base_list_view.rb', line 14

def initialize(presenter:, options: {})
  @presenter = presenter
  @options = options&.dup || {}
  @color_theme = Models::ColorTheme.find(theme_name: theme_name)
end

Instance Attribute Details

#presenterObject (readonly)

Returns the value of attribute presenter.



12
13
14
# File 'lib/dsu/views/base_list_view.rb', line 12

def presenter
  @presenter
end

Instance Method Details

#renderObject



20
21
22
23
24
25
# File 'lib/dsu/views/base_list_view.rb', line 20

def render
  yield
rescue StandardError => e
  puts apply_theme(e.message, theme_color: color_theme.error)
  puts apply_theme(e.backtrace_locations.join("\n"), theme_color: color_theme.error) if Dsu.env.local?
end