Class: Thunderbird::Subdirectory
- Inherits:
-
Object
- Object
- Thunderbird::Subdirectory
- Defined in:
- lib/thunderbird/subdirectory.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
‘path` is the UI path, it doesn’t have the ‘.sbd’ extensions that are present in the real, file system path.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
Instance Method Summary collapse
-
#full_path ⇒ Object
subdirectory relative path is ‘Foo.sbd/Bar.sbd/Baz.sbd’.
-
#initialize(profile, path) ⇒ Subdirectory
constructor
A new instance of Subdirectory.
- #set_up ⇒ Object
Constructor Details
#initialize(profile, path) ⇒ Subdirectory
Returns a new instance of Subdirectory.
9 10 11 12 |
# File 'lib/thunderbird/subdirectory.rb', line 9 def initialize(profile, path) @profile = profile @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
‘path` is the UI path, it doesn’t have the ‘.sbd’ extensions that are present in the real, file system path
6 7 8 |
# File 'lib/thunderbird/subdirectory.rb', line 6 def path @path end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
7 8 9 |
# File 'lib/thunderbird/subdirectory.rb', line 7 def profile @profile end |
Instance Method Details
#full_path ⇒ Object
subdirectory relative path is ‘Foo.sbd/Bar.sbd/Baz.sbd’
32 33 34 35 |
# File 'lib/thunderbird/subdirectory.rb', line 32 def full_path relative_path = File.join(subdirectories) File.join(profile.local_folders_path, relative_path) end |
#set_up ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/thunderbird/subdirectory.rb', line 14 def set_up raise "Cannot create a subdirectory without a path" if !sub_directory? if sub_sub_directory? parent_ok = parent.set_up return false if !parent_ok end ok = check return false if !ok FileUtils.mkdir_p full_path placeholder.touch true end |