Class: Dsu::Views::Export
- Inherits:
-
Object
- Object
- Dsu::Views::Export
- Includes:
- Support::Ask, Support::ColorThemable
- Defined in:
- lib/dsu/views/export.rb
Instance Method Summary collapse
-
#initialize(presenter:, options:) ⇒ Export
constructor
A new instance of Export.
- #render ⇒ Object
Methods included from Support::ColorThemable
apply_theme, #prompt_with_options
Methods included from Support::Ask
Constructor Details
#initialize(presenter:, options:) ⇒ Export
Returns a new instance of Export.
13 14 15 16 17 |
# File 'lib/dsu/views/export.rb', line 13 def initialize(presenter:, options:) @presenter = presenter @options = &.dup || {} @color_theme = Models::ColorTheme.find(theme_name: theme_name) end |
Instance Method Details
#render ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dsu/views/export.rb', line 19 def render return if presenter.nothing_to_export? response = display_export_prompt if presenter.respond response: response (file_path: presenter.export_file_path) else end rescue StandardError => e puts apply_theme(e., theme_color: color_theme.error) puts apply_theme(e.backtrace_locations.join("\n"), theme_color: color_theme.error) if Dsu.env.local? end |