Class: Fsinv::DirectoryDescription
- Inherits:
-
BaseDescription
- Object
- BaseDescription
- Fsinv::DirectoryDescription
- Includes:
- Fsinv
- Defined in:
- lib/fsinv/directorydescription.rb
Constant Summary
Constants included from Fsinv
BYTES_IN_GB, BYTES_IN_GiB, BYTES_IN_KB, BYTES_IN_KiB, BYTES_IN_MB, BYTES_IN_MiB, BYTES_IN_TB, BYTES_IN_TiB, IGNORE_FILES, PSEUDO_FILES, VERSION
Instance Attribute Summary collapse
-
#file_count ⇒ Object
Returns the value of attribute file_count.
-
#file_list ⇒ Object
Returns the value of attribute file_list.
-
#item_count ⇒ Object
Returns the value of attribute item_count.
Attributes inherited from BaseDescription
#bytes, #ctime, #fshugo_tags, #mtime, #osx_tags, #path
Instance Method Summary collapse
-
#as_json(options = { }) ⇒ Object
to_hash.
-
#initialize(path, reduced_scan = false) ⇒ DirectoryDescription
constructor
A new instance of DirectoryDescription.
- #marshal_dump ⇒ Object
- #marshal_load(data) ⇒ Object
-
#to_hash ⇒ Object
initialize.
- #to_json(*a) ⇒ Object
Methods included from Fsinv
filestructure_to_db, filestructure_to_xml, inventory_to_json, inventory_to_xml, inventory_to_yaml, parse, pretty_IEC_bytes, pretty_SI_bytes, sanitize_string
Methods inherited from BaseDescription
Constructor Details
#initialize(path, reduced_scan = false) ⇒ DirectoryDescription
Returns a new instance of DirectoryDescription.
12 13 14 15 16 17 18 19 |
# File 'lib/fsinv/directorydescription.rb', line 12 def initialize(path, reduced_scan = false) super(path,reduced_scan) @file_list = [] @file_count = 0 @item_count = 0 end |
Instance Attribute Details
#file_count ⇒ Object
Returns the value of attribute file_count.
10 11 12 |
# File 'lib/fsinv/directorydescription.rb', line 10 def file_count @file_count end |
#file_list ⇒ Object
Returns the value of attribute file_list.
10 11 12 |
# File 'lib/fsinv/directorydescription.rb', line 10 def file_list @file_list end |
#item_count ⇒ Object
Returns the value of attribute item_count.
10 11 12 |
# File 'lib/fsinv/directorydescription.rb', line 10 def item_count @item_count end |
Instance Method Details
#as_json(options = { }) ⇒ Object
to_hash
30 31 32 |
# File 'lib/fsinv/directorydescription.rb', line 30 def as_json( = { }) return to_hash end |
#marshal_dump ⇒ Object
38 39 40 41 42 43 |
# File 'lib/fsinv/directorydescription.rb', line 38 def marshal_dump h = self.to_json h.delete("type") return h end |
#marshal_load(data) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/fsinv/directorydescription.rb', line 45 def marshal_load(data) self.path = data['path'] self.bytes = data['bytes'] self.ctime = data['ctime'] if data['ctime'].exists? self.mtime = data['mtime'] if data['mtime'].exists? self.file_count = data['file_count'] if data['file_count'].exists? self.item_count = data['item_count'] if data['item_count'].exists? self. = data['osx_tags'] if data['osx_tags'].exists? self. = data['fshugo_tags'] if data['fshugo_tags'].exists? self.file_list = data['file_list'] end |
#to_hash ⇒ Object
initialize
21 22 23 24 25 26 27 28 |
# File 'lib/fsinv/directorydescription.rb', line 21 def to_hash h = { "type" => "directory" } h = h.merge(super.to_hash) h["file_count"] = @file_count h["item_count"] = @item_count h["file_list"] = @file_list return h end |
#to_json(*a) ⇒ Object
34 35 36 |
# File 'lib/fsinv/directorydescription.rb', line 34 def to_json(*a) return as_json.to_json(*a) end |