folder_stash 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93dce10844def9a81b889a6d7c2945478d5c28071134ae2e4c82c3c7eddf8821
|
4
|
+
data.tar.gz: 1159df6fc56cf5eae6381bc10c9871bc97389293d267d0cf156b810a141f8f63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03f4b85520693efbc1ec1b23064adfff34c342a57c50beb47861f4b82d52d12b8fbc07896d68737a09ee73e60be9d16c46328159f1b3ddeeb3cd20f15e50a40b
|
7
|
+
data.tar.gz: 7b33bb6277bd78933e6a0d247eb5bd30e26a10f83d5b9a3e9be3099a283fb7100426cd47cadd82123b8b2ba8e0cb034f46f64e702338fcdbf35c8af3095d932c
|
@@ -15,7 +15,7 @@ module FolderStash
|
|
15
15
|
attr_reader :tree_limit
|
16
16
|
|
17
17
|
def initialize(msg = nil, tree: nil)
|
18
|
-
@subdirs = tree.
|
18
|
+
@subdirs = tree.subdirectories
|
19
19
|
@subdir_limit = tree.folder_limit
|
20
20
|
@tree_limit = tree.tree_limit
|
21
21
|
msg ||= 'The storage tree has reached the limit of allowed items:'\
|
@@ -11,7 +11,7 @@ module FolderStash
|
|
11
11
|
attr_reader :folder_limit
|
12
12
|
|
13
13
|
# The number of items (directories) in a nested directory path, from the
|
14
|
-
# #root to the #terminal.
|
14
|
+
# #root (base directory) to the #terminal.
|
15
15
|
attr_reader :path_length
|
16
16
|
|
17
17
|
attr_reader :tree_limit
|
@@ -26,9 +26,9 @@ module FolderStash
|
|
26
26
|
# tree's directory path.
|
27
27
|
def initialize(folders, levels, limit)
|
28
28
|
@folders = folders
|
29
|
-
@path_length = levels
|
29
|
+
@path_length = levels ? levels + 1 : nil
|
30
30
|
@folder_limit = limit
|
31
|
-
@tree_limit = folder_limit ? folder_limit**(path_length
|
31
|
+
@tree_limit = folder_limit ? folder_limit**(path_length) : nil
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.empty(root, levels:, limit:)
|
@@ -71,11 +71,16 @@ module FolderStash
|
|
71
71
|
actual_path_length == 1 && path_length.nil?
|
72
72
|
end
|
73
73
|
|
74
|
-
# Returns the number
|
74
|
+
# Returns the number of levels of folders nested in +folder+.
|
75
75
|
def levels_below(folder)
|
76
76
|
return if flat?
|
77
77
|
|
78
|
-
|
78
|
+
subdirectories - folders.index(folder)
|
79
|
+
end
|
80
|
+
|
81
|
+
# The nesting depth (Integer) of subdirectories in the base directory.
|
82
|
+
def subdirectories
|
83
|
+
path_length - 1
|
79
84
|
end
|
80
85
|
|
81
86
|
# Creates a new branch of folders in +folder+ and updates #folders to the
|
metadata
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: folder_stash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Stein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
|
-
The
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
The folder_stash gem will store files in a directory with a user definable
|
15
|
+
number of nested subdirectories in a given path and a maximum number of
|
16
|
+
items allowed per subdirectory.
|
18
17
|
New nested subdirectories will be created on demand as a given subdirectory
|
19
18
|
reaches the specified limit of items. All created subdirectories will have
|
20
19
|
randomized base names.
|