Sha256: dcc5417200af1369068b0250eb211f29143b90b65d60f52ac1e652e2125ea7e0
Contents?: true
Size: 1.45 KB
Versions: 6
Compression:
Stored size: 1.45 KB
Contents
# frozen_string_literal: true require_relative '../../models/entry_group' require_relative '../../support/ask' require_relative '../base_presenter_ex' require_relative 'messages' require_relative 'nothing_to_export' require_relative 'service_callable' module Dsu module Presenters module Export class DatesPresenter < BasePresenterEx include Messages include NothingToExport include ServiceCallable include Support::Ask def initialize(from:, to:, options: {}) super(options: options) @from = from @to = to end def render(response:) return display_cancelled_message unless response export_file_path = exporter_service_call display_exported_message display_exported_to_message(file_path: export_file_path) end def display_export_prompt yes?(prompt_with_options(prompt: export_prompt, options: export_prompt_options), options: options) end private attr_reader :from, :to, :options def entry_groups Models::EntryGroup.entry_groups(between: [from, to]) end def export_prompt I18n.t('subcommands.export.prompts.export_dates_confirm', from: from.to_date, to: to.to_date, count: entry_groups.count) end def export_prompt_options I18n.t('subcommands.export.prompts.options') end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems