Class: NestedFile::ConvertPath
- Inherits:
-
Object
- Object
- NestedFile::ConvertPath
- Includes:
- FromHash
- Defined in:
- lib/nested_file/put_dir.rb
Instance Attribute Summary collapse
-
#mount_dir ⇒ Object
Returns the value of attribute mount_dir.
-
#parent_dir ⇒ Object
Returns the value of attribute parent_dir.
Instance Method Summary collapse
-
#mount_to_parent(path) ⇒ Object
converts the directory relative to the mount point to an absolute parent path.
- #mount_to_parent_if_relative(path) ⇒ Object
- #parent_to_mount(path) ⇒ Object
Instance Attribute Details
#mount_dir ⇒ Object
Returns the value of attribute mount_dir.
4 5 6 |
# File 'lib/nested_file/put_dir.rb', line 4 def mount_dir @mount_dir end |
#parent_dir ⇒ Object
Returns the value of attribute parent_dir.
4 5 6 |
# File 'lib/nested_file/put_dir.rb', line 4 def parent_dir @parent_dir end |
Instance Method Details
#mount_to_parent(path) ⇒ Object
converts the directory relative to the mount point to an absolute parent path
6 7 8 |
# File 'lib/nested_file/put_dir.rb', line 6 def mount_to_parent(path) File.join parent_dir, path end |
#mount_to_parent_if_relative(path) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/nested_file/put_dir.rb', line 12 def mount_to_parent_if_relative(path) if Pathname.new(path).absolute? path else mount_to_parent(path) end end |
#parent_to_mount(path) ⇒ Object
9 10 11 |
# File 'lib/nested_file/put_dir.rb', line 9 def parent_to_mount(path) path.gsub("#{parent_dir}/","") end |