Class: Imap::Backup::Serializer::Files::Path

Inherits:
Data
  • Object
show all
Defined in:
lib/imap/backup/serializer/files/path.rb

Overview

A Data class representing the path to a folder’s serialized data it contains two elements: the base path and the folder name. The base path is the root path for an account’s backup, and the folder name is the name of the folder within that account. If the folder name is nil, the path represents the base path only.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_pathObject (readonly)

Returns the value of attribute base_path

Returns:

  • (Object)

    the current value of base_path



12
13
14
# File 'lib/imap/backup/serializer/files/path.rb', line 12

def base_path
  @base_path
end

#folder_nameObject (readonly)

Returns the value of attribute folder_name

Returns:

  • (Object)

    the current value of folder_name



12
13
14
# File 'lib/imap/backup/serializer/files/path.rb', line 12

def folder_name
  @folder_name
end

Instance Method Details

#directoryString

Returns the directory containing the folder’s serialized data.

Returns:

  • (String)

    the directory containing the folder’s serialized data



19
20
21
22
23
24
25
# File 'lib/imap/backup/serializer/files/path.rb', line 19

def directory
  if folder_name
    File.dirname(to_s)
  else
    base_path
  end
end

#to_sString

Returns the full path to the folder’s serialized data.

Returns:

  • (String)

    the full path to the folder’s serialized data



14
15
16
# File 'lib/imap/backup/serializer/files/path.rb', line 14

def to_s
  File.join(base_path, folder_name)
end