Class: Thunderbird::LocalFolder
- Inherits:
-
Object
- Object
- Thunderbird::LocalFolder
- Defined in:
- lib/thunderbird/local_folder.rb
Instance Attribute Summary collapse
-
#folder_path ⇒ Object
readonly
Returns the value of attribute folder_path.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
Instance Method Summary collapse
- #directory_exists? ⇒ Boolean
- #directory_is_directory? ⇒ Boolean
- #folder_path_elements ⇒ Object
- #full_path ⇒ Object
-
#initialize(profile, folder_path) ⇒ LocalFolder
constructor
A new instance of LocalFolder.
- #is_directory? ⇒ Boolean
- #local_folder_placeholder ⇒ Object
- #parent ⇒ Object
- #relative_path ⇒ Object
- #set_up ⇒ Object
- #subdirectories ⇒ Object
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_path ⇒ Object (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 |
#profile ⇒ Object (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
38 39 40 |
# File 'lib/thunderbird/local_folder.rb', line 38 def directory_exists? File.exists?(full_path) end |
#directory_is_directory? ⇒ Boolean
20 21 22 |
# File 'lib/thunderbird/local_folder.rb', line 20 def directory_is_directory? File.directory?(full_path) end |
#folder_path_elements ⇒ Object
34 35 36 |
# File 'lib/thunderbird/local_folder.rb', line 34 def folder_path_elements folder_path.split(File::SEPARATOR) end |
#full_path ⇒ Object
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
42 43 44 |
# File 'lib/thunderbird/local_folder.rb', line 42 def is_directory? File.directory?(full_path) end |
#local_folder_placeholder ⇒ Object
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 |
#parent ⇒ Object
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_path ⇒ Object
50 51 52 |
# File 'lib/thunderbird/local_folder.rb', line 50 def relative_path File.join(subdirectories) end |
#set_up ⇒ Object
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 |
#subdirectories ⇒ Object
46 47 48 |
# File 'lib/thunderbird/local_folder.rb', line 46 def subdirectories folder_path_elements.map { |p| "#{p}.sbd" } end |