Class: Thunderbird::LocalFolder

Inherits:
Object
  • Object
show all
Defined in:
lib/thunderbird/local_folder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(profile, folder_path) ⇒ LocalFolder

Returns a new instance of LocalFolder.



8
9
10
11
# File 'lib/thunderbird/local_folder.rb', line 8

def initialize(profile, folder_path)
  @profile = profile
  @folder_path = folder_path
end

Instance Attribute Details

#folder_pathObject (readonly)

Returns the value of attribute folder_path.



5
6
7
# File 'lib/thunderbird/local_folder.rb', line 5

def folder_path
  @folder_path
end

#profileObject (readonly)

Returns the value of attribute profile.



6
7
8
# File 'lib/thunderbird/local_folder.rb', line 6

def profile
  @profile
end

Instance Method Details

#directory_exists?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/thunderbird/local_folder.rb', line 38

def directory_exists?
  File.exists?(full_path)
end

#directory_is_directory?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/thunderbird/local_folder.rb', line 20

def directory_is_directory?
  File.directory?(full_path)
end

#folder_path_elementsObject



34
35
36
# File 'lib/thunderbird/local_folder.rb', line 34

def folder_path_elements
  folder_path.split(File::SEPARATOR)
end

#full_pathObject



24
25
26
# File 'lib/thunderbird/local_folder.rb', line 24

def full_path
  File.join(profile.local_folders_path, relative_path)
end

#is_directory?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/thunderbird/local_folder.rb', line 42

def is_directory?
  File.directory?(full_path)
end

#local_folder_placeholderObject



13
14
15
16
17
18
# File 'lib/thunderbird/local_folder.rb', line 13

def local_folder_placeholder
  if parent
    path = File.join(parent.full_path, folder_path_elements[-1])
    Thunderbird::LocalFolderPlaceholder.new(path)
  end
end

#parentObject



28
29
30
31
32
# File 'lib/thunderbird/local_folder.rb', line 28

def parent
  if folder_path_elements.count > 0
    self.class.new(profile, File.join(folder_path_elements[0..-2]))
  end
end

#relative_pathObject



50
51
52
# File 'lib/thunderbird/local_folder.rb', line 50

def relative_path
  File.join(subdirectories)
end

#set_upObject



54
55
56
57
58
59
# File 'lib/thunderbird/local_folder.rb', line 54

def set_up
  ok = check
  return if !ok

  ensure_initialized
end

#subdirectoriesObject



46
47
48
# File 'lib/thunderbird/local_folder.rb', line 46

def subdirectories
  folder_path_elements.map { |p| "#{p}.sbd" }
end