Module: Ftpmock::PathHelper
- Defined in:
- lib/ftpmock/helpers/path_helper.rb
Class Method Summary collapse
Class Method Details
.clean(path) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/ftpmock/helpers/path_helper.rb', line 5 def clean(path) path = path.to_s path = path[1..-1] if path[0] == '/' path = Pathname(path).cleanpath return Pathname('') if path.to_s == '.' path end |
.join(path_a, path_b) ⇒ Object
14 15 16 |
# File 'lib/ftpmock/helpers/path_helper.rb', line 14 def join(path_a, path_b) clean Pathname(path_a.to_s).join(path_b.to_s) end |
.simplify(path) ⇒ Object
18 19 20 21 22 |
# File 'lib/ftpmock/helpers/path_helper.rb', line 18 def simplify(path) path.to_s .tr('/', '-') .tr('..', '__') end |