Class: EverboxClient::PathEntry
- Inherits:
-
Object
- Object
- EverboxClient::PathEntry
- Defined in:
- lib/everbox_client/models/path_entry.rb
Constant Summary collapse
- MASK_FILE =
0x1
- MASK_DIR =
0x2
- MASK_DELETED =
0x8000
Instance Method Summary collapse
- #basename ⇒ Object
- #deleted? ⇒ Boolean
- #dir? ⇒ Boolean
- #entries ⇒ Object
- #file? ⇒ Boolean
-
#initialize(data) ⇒ PathEntry
constructor
A new instance of PathEntry.
- #path ⇒ Object
- #to_line ⇒ Object
Constructor Details
#initialize(data) ⇒ PathEntry
Returns a new instance of PathEntry.
7 8 9 |
# File 'lib/everbox_client/models/path_entry.rb', line 7 def initialize(data) @data = data end |
Instance Method Details
#basename ⇒ Object
11 12 13 |
# File 'lib/everbox_client/models/path_entry.rb', line 11 def basename @data["path"].split('/')[-1] end |
#deleted? ⇒ Boolean
23 24 25 |
# File 'lib/everbox_client/models/path_entry.rb', line 23 def deleted? (@data["type"] & MASK_DELETED) != 0 end |
#dir? ⇒ Boolean
19 20 21 |
# File 'lib/everbox_client/models/path_entry.rb', line 19 def dir? (@data["type"] & MASK_DIR) != 0 end |
#entries ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/everbox_client/models/path_entry.rb', line 27 def entries @entries ||= begin if @data["entries"].nil? [] else @data["entries"].map {|x| PathEntry.new(x)} end end end |
#file? ⇒ Boolean
15 16 17 |
# File 'lib/everbox_client/models/path_entry.rb', line 15 def file? (@data["type"] & MASK_FILE) != 0 end |
#path ⇒ Object
38 39 40 |
# File 'lib/everbox_client/models/path_entry.rb', line 38 def path @data["path"] end |
#to_line ⇒ Object
42 43 44 45 |
# File 'lib/everbox_client/models/path_entry.rb', line 42 def to_line suffix = dir? ? '/' : '' "#{"%10d" % @data["fileSize"]}\t#{basename}#{suffix}\n" end |