store-digest 0.3.0 → 0.3.1
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/store/digest/object.rb +24 -3
- data/lib/store/digest/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53000b2277712556bc9fdc4e3a8aa04bc1f2d6c4a432cd672ca1363901f1772d
|
|
4
|
+
data.tar.gz: ae7ff0deb6b21b7eb24031a44a74aed287866e792891331164fcf79df6894ab5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc4f0a08994b1382bb75cd34015e8984f65121439597bae891cfa5bdd55f7ab046b70f86995a4e3840eac699304540d0d92d408450366a11d324543f97ab8cb6
|
|
7
|
+
data.tar.gz: 19097b9434eb605b7ebfbc5c1af3d59caefae3d06d241437b7e66c24f9a95b9172fa5a40f754804dfd9192f7833dd4fdc0a51e38273345e0fe43fbac9f28ee4e
|
data/lib/store/digest/object.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'store/digest/version'
|
|
2
2
|
|
|
3
|
+
require 'forwardable'
|
|
3
4
|
require 'uri'
|
|
4
5
|
require 'uri/ni'
|
|
5
6
|
require 'mimemagic'
|
|
@@ -71,6 +72,23 @@ end
|
|
|
71
72
|
#
|
|
72
73
|
class Store::Digest::Object
|
|
73
74
|
|
|
75
|
+
# Proxy IO instance that has a backreference to the store object.
|
|
76
|
+
#
|
|
77
|
+
class IOWrapper
|
|
78
|
+
extend Forwardable
|
|
79
|
+
|
|
80
|
+
def initialize object, io
|
|
81
|
+
@object = object
|
|
82
|
+
@io = io
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
attr_reader :object
|
|
86
|
+
|
|
87
|
+
# any others??
|
|
88
|
+
def_delegators :@io, :gets, :read, :each, :seek, :pos, :rewind
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
|
|
74
92
|
# These is a struct for the bank of flags, with a couple of extra
|
|
75
93
|
# methods for parsing
|
|
76
94
|
#
|
|
@@ -432,7 +450,7 @@ class Store::Digest::Object
|
|
|
432
450
|
def fresh?
|
|
433
451
|
!!@fresh
|
|
434
452
|
end
|
|
435
|
-
|
|
453
|
+
|
|
436
454
|
def fresh= state
|
|
437
455
|
@fresh = !!state
|
|
438
456
|
end
|
|
@@ -455,9 +473,12 @@ class Store::Digest::Object
|
|
|
455
473
|
alias_method :"[]", :digest
|
|
456
474
|
|
|
457
475
|
# Returns the content stored in the object.
|
|
458
|
-
#
|
|
476
|
+
#
|
|
477
|
+
# @return [#read]
|
|
478
|
+
#
|
|
459
479
|
def content
|
|
460
|
-
@content.is_a?(Proc) ? @content.call : @content
|
|
480
|
+
io = @content.is_a?(Proc) ? @content.call : @content
|
|
481
|
+
io = io ? IOWrapper.new(self, io) : io
|
|
461
482
|
end
|
|
462
483
|
|
|
463
484
|
# Determines if there is content embedded in the object.
|
data/lib/store/digest/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: store-digest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dorian Taylor
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: bundler
|
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
180
|
version: '0'
|
|
181
181
|
requirements: []
|
|
182
|
-
rubygems_version: 3.6.
|
|
182
|
+
rubygems_version: 3.6.7
|
|
183
183
|
specification_version: 4
|
|
184
184
|
summary: Lightweight, multi-digest content-addressable store
|
|
185
185
|
test_files: []
|