Class: Dsu::Subcommands::Import
- Inherits:
-
BaseSubcommand
- Object
- Thor
- BaseCLI
- BaseSubcommand
- Dsu::Subcommands::Import
- Defined in:
- lib/dsu/subcommands/import.rb
Constant Summary
Constants included from Dsu::Support::CommandOptions::TimeMnemonics
Dsu::Support::CommandOptions::TimeMnemonics::RELATIVE_REGEX, Dsu::Support::CommandOptions::TimeMnemonics::TODAY, Dsu::Support::CommandOptions::TimeMnemonics::TOMORROW, Dsu::Support::CommandOptions::TimeMnemonics::YESTERDAY
Instance Method Summary collapse
Methods included from Dsu::Support::TimeFormatable
dd_mm_yyyy, formatted_time, mm_dd, mm_dd_yyyy, timezone_for, yyyy_mm_dd, yyyy_mm_dd_or_through_for
Methods included from Dsu::Support::CommandOptions::TimeMnemonic
relative_time_mnemonic?, time_from_mnemonic, time_from_mnemonic!, time_mnemonic?
Methods included from Dsu::Support::Ask
Methods inherited from BaseCLI
date_option_description, exit_on_failure?, #initialize, mnemonic_option_description
Methods included from Dsu::Support::TimesSortable
#sorted_dsu_times_for, #times_for, #times_sort
Methods included from Dsu::Support::CommandHookable
Methods included from Dsu::Support::CommandHelpColorizable
Methods included from Dsu::Support::ColorThemable
apply_theme, #prompt_with_options
Constructor Details
This class inherits a constructor from Dsu::BaseCLI
Instance Method Details
#all ⇒ Object
29 30 31 32 33 |
# File 'lib/dsu/subcommands/import.rb', line 29 def all = configuration.to_h.merge(self.).with_indifferent_access Views::Import.new(presenter: all_presenter(import_file_path: [:import_file], options: ), options: ).render end |
#dates ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/dsu/subcommands/import.rb', line 45 def dates = configuration.to_h.merge(self.).with_indifferent_access times, errors = Support::CommandOptions::DsuTimes.dsu_times_for(from_option: [:from], to_option: [:to]) # rubocop:disable Layout/LineLength if errors.any? Views::Shared::Error.new(messages: errors).render return end Views::ImportDates.new(presenter: dates_presenter_for(from: times.min, to: times.max, import_file_path: [:import_file], options: ), options: ).render rescue ArgumentError => e Views::Shared::Error.new(messages: e.).render end |