Sha256: 26167db683341fea2bea16c2beb1216a4804a73275646fd2a92e80b56af9321f

Contents?: true

Size: 1 KB

Versions: 22

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require_relative '../../models/entry_group'
require_relative '../../services/entry_group/exporter_service'
require_relative '../base_presenter_ex'

module Dsu
  module Presenters
    module Export
      class AllPresenter < BasePresenterEx
        attr_reader :export_file_path

        def respond(response:)
          return false unless response

          @export_file_path = exporter_service.call
        end

        def nothing_to_export?
          entry_group_count.zero?
        end

        def entry_group_count
          entry_groups&.count || 0
        end

        private

        def entry_groups
          @entry_groups ||= Models::EntryGroup.all
        end

        def exporter_service
          Services::EntryGroup::ExporterService.new(project_name: project_name,
            entry_groups: entry_groups, options: options)
        end

        def project_name
          @project_name ||= Models::Project.current_project.project_name
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
dsu-3.0.5 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.4 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.3 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.1 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.beta.3 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.beta.2 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.beta.1 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.beta.0 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.12 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.11 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.10 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.9 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.8 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.7 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.6 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.5 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.4 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.3 lib/dsu/presenters/export/all_presenter.rb
dsu-3.0.0.alpha.2 lib/dsu/presenters/export/all_presenter.rb