Class: RestFtpDaemon::Path
- Inherits:
-
Object
- Object
- RestFtpDaemon::Path
- Defined in:
- lib/rest-ftp-daemon/path.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #full ⇒ Object
-
#initialize(full, strip_leading_slash = false) ⇒ Path
constructor
A new instance of Path.
- #size ⇒ Object
Constructor Details
#initialize(full, strip_leading_slash = false) ⇒ Path
Returns a new instance of Path.
6 7 8 9 10 11 12 13 |
# File 'lib/rest-ftp-daemon/path.rb', line 6 def initialize full, strip_leading_slash = false # Extract path parts @name = extract_filename full.to_s @dir = extract_dirname full.to_s # Remove leading slash if needed strip_leading_slash_from_dir! if strip_leading_slash end |
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
4 5 6 |
# File 'lib/rest-ftp-daemon/path.rb', line 4 def dir @dir end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/rest-ftp-daemon/path.rb', line 3 def name @name end |
Instance Method Details
#full ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rest-ftp-daemon/path.rb', line 15 def full if @dir.nil? || @dir.empty? return @name else return File.join @dir, @name end end |
#size ⇒ Object
23 24 25 |
# File 'lib/rest-ftp-daemon/path.rb', line 23 def size File.size full if File.exist? full end |