Class: Dsu::Views::Project::Use
- Inherits:
-
Object
- Object
- Dsu::Views::Project::Use
- Includes:
- Support::Ask, Support::ColorThemable
- Defined in:
- lib/dsu/views/project/use.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#presenter ⇒ Object
readonly
Returns the value of attribute presenter.
Instance Method Summary collapse
-
#initialize(presenter:, options: {}) ⇒ Use
constructor
A new instance of Use.
- #render ⇒ Object
Methods included from Support::ColorThemable
apply_theme, #prompt_with_options
Methods included from Support::Ask
Constructor Details
#initialize(presenter:, options: {}) ⇒ Use
Returns a new instance of Use.
17 18 19 20 21 |
# File 'lib/dsu/views/project/use.rb', line 17 def initialize(presenter:, options: {}) @presenter = presenter @options = &.dup || {} @color_theme = Models::ColorTheme.find(theme_name: theme_name) end |
Instance Attribute Details
#presenter ⇒ Object (readonly)
Returns the value of attribute presenter.
15 16 17 |
# File 'lib/dsu/views/project/use.rb', line 15 def presenter @presenter end |
Instance Method Details
#render ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dsu/views/project/use.rb', line 23 def render return display_project_does_not_exist if presenter.project_does_not_exist? return display_project_already_current_project if presenter.already_current_project? return display_project_errors if presenter.project_errors.any? response = display_project_use_prompt if presenter.respond response: response 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 |