fileverse 0.1.5 → 0.1.6
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 +4 -4
- data/lib/fileverse/cli.rb +5 -1
- data/lib/fileverse/errors.rb +11 -4
- data/lib/fileverse/parser.rb +3 -8
- data/lib/fileverse/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5edf7aff9bcb4c6c6b9f59f9cc0b50d1413183e884aad9f38de7e2be7057eb80
|
4
|
+
data.tar.gz: 2c62e407c449f6985232d838be9d04ba3c4b50ad55658afa74c251507e5ef42f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40729a548fafc408dc36a2484e151e42af3e1fd5cff309a28814c4f3e2f00da2a6ca7799b99608d6747d0135537fd2ad83979ea191b68f7f8de7b6f901867ec2
|
7
|
+
data.tar.gz: 713f376692bc057597933f737a4686aca65153b83d6ad7093617bf7782afa1a67fa54efc5a27b8dda1464198fd8f793cbcdb210b58bbd6f4358463523f314605
|
data/lib/fileverse/cli.rb
CHANGED
@@ -34,6 +34,8 @@ module Fileverse
|
|
34
34
|
@previewer.preview_content = preview_content
|
35
35
|
Files.write_content(@path, @previewer.to_writable_lines)
|
36
36
|
Files.write_content(@hidden_path, @parser.to_writable_lines)
|
37
|
+
rescue StandardError => e
|
38
|
+
puts e.message
|
37
39
|
end
|
38
40
|
map "p" => "preview"
|
39
41
|
|
@@ -79,7 +81,7 @@ module Fileverse
|
|
79
81
|
Files.write_content(@path, template_content)
|
80
82
|
end
|
81
83
|
|
82
|
-
def preview_content
|
84
|
+
def preview_content # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
83
85
|
if options[:name]
|
84
86
|
@parser.snapshot_content_by_name(options[:name])
|
85
87
|
elsif options[:bwd]
|
@@ -88,6 +90,8 @@ module Fileverse
|
|
88
90
|
@parser.snapshot_content_forward
|
89
91
|
elsif options[:index]
|
90
92
|
@parser.snapshot_content_by_index(options[:index])
|
93
|
+
else
|
94
|
+
@parser.cursor_content
|
91
95
|
end
|
92
96
|
end
|
93
97
|
end
|
data/lib/fileverse/errors.rb
CHANGED
@@ -17,10 +17,17 @@ module Fileverse
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
# Error for
|
21
|
-
class
|
22
|
-
def initialize
|
23
|
-
super("
|
20
|
+
# Error for negative cursor
|
21
|
+
class NegativeCursorPointer < StandardError
|
22
|
+
def initialize
|
23
|
+
super("Cursor can not be negative.")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Error for maximum cursor
|
28
|
+
class MaxCursorPointer < StandardError
|
29
|
+
def initialize
|
30
|
+
super("Cursor can not be larger that snapped length.")
|
24
31
|
end
|
25
32
|
end
|
26
33
|
end
|
data/lib/fileverse/parser.rb
CHANGED
@@ -105,7 +105,8 @@ module Fileverse
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def cursor_content
|
108
|
-
raise
|
108
|
+
raise NegativeCursorPointer if @cursor.negative?
|
109
|
+
raise MaxCursorPointer if @cursor >= @snapshots.length
|
109
110
|
|
110
111
|
@snapshots[@cursor].content
|
111
112
|
end
|
@@ -115,9 +116,7 @@ module Fileverse
|
|
115
116
|
end
|
116
117
|
|
117
118
|
def snapshot_content_by_index(index)
|
118
|
-
|
119
|
-
|
120
|
-
@cursor = value
|
119
|
+
@cursor = index
|
121
120
|
cursor_content
|
122
121
|
end
|
123
122
|
|
@@ -173,14 +172,10 @@ module Fileverse
|
|
173
172
|
end
|
174
173
|
|
175
174
|
def decrement_cursor
|
176
|
-
raise InvalidCursorPointer if (@cursor - 1).negative?
|
177
|
-
|
178
175
|
@cursor -= 1
|
179
176
|
end
|
180
177
|
|
181
178
|
def increment_cursor
|
182
|
-
raise InvalidCursorPointer if @cursor + 1 >= @snapshots.length
|
183
|
-
|
184
179
|
@cursor += 1
|
185
180
|
end
|
186
181
|
|
data/lib/fileverse/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fileverse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Unegbu Kingsley
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|