Module: Dsu::Presenters::Import::ImportFile

Included in:
AllPresenter, DatesPresenter
Defined in:
lib/dsu/presenters/import/import_file.rb

Instance Method Summary collapse

Instance Method Details

#import_entry_groupsObject

Raises:

  • (NotImplementedError)


17
18
19
20
21
# File 'lib/dsu/presenters/import/import_file.rb', line 17

def import_entry_groups
  # Should return a Hash of entry group entries
  # Example: { '2023-12-32' => ['Entry description 1', 'Entry description 2', ...] }
  raise NotImplementedError
end

#import_entry_groups_countObject



23
24
25
26
27
28
29
# File 'lib/dsu/presenters/import/import_file.rb', line 23

def import_entry_groups_count
  if overriding_project?
    import_entry_groups&.first&.count || 0
  else
    import_entry_groups[project_name]&.count || 0
  end
end

#import_file_path_exist?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/dsu/presenters/import/import_file.rb', line 7

def import_file_path_exist?
  File.exist? import_file_path
end

#nothing_to_import?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/dsu/presenters/import/import_file.rb', line 11

def nothing_to_import?
  return true unless import_file_path_exist?

  import_entry_groups.count.zero?
end