content_data 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.
- data/lib/content_data/content_data.rb +7 -6
- metadata +2 -2
|
@@ -223,6 +223,7 @@ module BBFS
|
|
|
223
223
|
@contents.key? checksum
|
|
224
224
|
end
|
|
225
225
|
|
|
226
|
+
# TODO(kolman): The semantics of thir merge is merge! change in all file.
|
|
226
227
|
def merge(content_data)
|
|
227
228
|
content_data.contents.values.each { |content|
|
|
228
229
|
add_content(content)
|
|
@@ -318,7 +319,7 @@ module BBFS
|
|
|
318
319
|
end
|
|
319
320
|
|
|
320
321
|
def self.parse_time(time_str)
|
|
321
|
-
return
|
|
322
|
+
return nil unless time_str.instance_of? String
|
|
322
323
|
time = Time.strptime( time_str, '%Y/%m/%d %H:%M:%S.%L' )
|
|
323
324
|
# another option to parse a time
|
|
324
325
|
#require 'scanf.rb'
|
|
@@ -327,7 +328,7 @@ module BBFS
|
|
|
327
328
|
end
|
|
328
329
|
|
|
329
330
|
def self.format_time(time)
|
|
330
|
-
return
|
|
331
|
+
return nil unless time.instance_of?Time
|
|
331
332
|
#puts time.class
|
|
332
333
|
str = time.strftime( '%Y/%m/%d %H:%M:%S.%L' )
|
|
333
334
|
#puts str
|
|
@@ -339,8 +340,8 @@ module BBFS
|
|
|
339
340
|
return b unless not a.nil?
|
|
340
341
|
return a unless not b.nil?
|
|
341
342
|
|
|
342
|
-
return
|
|
343
|
-
return
|
|
343
|
+
return nil unless a.instance_of?ContentData
|
|
344
|
+
return nil unless b.instance_of?ContentData
|
|
344
345
|
|
|
345
346
|
ret = ContentData.new
|
|
346
347
|
ret.merge(a)
|
|
@@ -351,8 +352,8 @@ module BBFS
|
|
|
351
352
|
|
|
352
353
|
# removed content data a from content data b and returns the new content data.
|
|
353
354
|
def self.remove(a, b)
|
|
354
|
-
return
|
|
355
|
-
return
|
|
355
|
+
return nil unless a.instance_of?ContentData
|
|
356
|
+
return nil unless b.instance_of?ContentData
|
|
356
357
|
|
|
357
358
|
ret = ContentData.new
|
|
358
359
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: content_data
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-04-
|
|
12
|
+
date: 2012-04-11 00:00:00.000000000Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: ! 'Data structure for an abstract layer over files. Each binary sequence
|
|
15
15
|
is a content, '
|