doc_storage 1.0.1 → 1.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/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/doc_storage/simple_document.rb +3 -14
- data/spec/simple_document_spec.rb +0 -13
- metadata +1 -1
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ end
|
|
14
14
|
|
15
15
|
specification = Gem::Specification.new do |s|
|
16
16
|
s.name = "doc_storage"
|
17
|
-
s.version = "1.0.
|
17
|
+
s.version = "1.0.2"
|
18
18
|
s.summary = "Simple Ruby library for manipulating documents containing a " +
|
19
19
|
"text and metadata."
|
20
20
|
s.description = "DocStorage is a simple Ruby library for manipulating " +
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
@@ -126,10 +126,6 @@ module DocStorage
|
|
126
126
|
result
|
127
127
|
end
|
128
128
|
|
129
|
-
def trim_last_char(s)
|
130
|
-
s[0..-2]
|
131
|
-
end
|
132
|
-
|
133
129
|
def parse_body(io, boundary)
|
134
130
|
if boundary
|
135
131
|
result = ""
|
@@ -139,22 +135,15 @@ module DocStorage
|
|
139
135
|
# Trim last newline from the body as it belongs to the boudnary
|
140
136
|
# logically. This behavior is implemented to allow bodies with
|
141
137
|
# no trailing newline).
|
142
|
-
return
|
138
|
+
return result[0..-2]
|
143
139
|
end
|
144
140
|
|
145
141
|
result += line
|
146
142
|
end
|
147
143
|
|
148
|
-
|
149
|
-
# when it physically wasn't there (which can happen at the end of a
|
150
|
-
# file). Note that only IO and its descendants behave this way (not
|
151
|
-
# StringIO, for example).
|
152
|
-
io.is_a?(IO) ? trim_last_char(result) : result
|
144
|
+
result
|
153
145
|
else
|
154
|
-
|
155
|
-
# when it physically wasn't there. Note that only IO and its
|
156
|
-
# descendants behave this way (not StringIO, for example).
|
157
|
-
io.is_a?(IO) ? trim_last_char(io.read) : io.read
|
146
|
+
io.read
|
158
147
|
end
|
159
148
|
end
|
160
149
|
|
@@ -198,19 +198,6 @@ module DocStorage
|
|
198
198
|
"====="
|
199
199
|
).should == @document_with_headers_with_body
|
200
200
|
end
|
201
|
-
|
202
|
-
it "works around the IO#readline bug" do
|
203
|
-
File.open(SIMPLE_FIXTURE_FILE, "r") do |f|
|
204
|
-
SimpleDocument.load(f).should == @document_with_headers_with_body
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
it "works around the IO#read bug when passed a boundary" do
|
209
|
-
File.open(SIMPLE_FIXTURE_FILE, "r") do |f|
|
210
|
-
SimpleDocument.load(f, "=====").should ==
|
211
|
-
@document_with_headers_with_body
|
212
|
-
end
|
213
|
-
end
|
214
201
|
end
|
215
202
|
|
216
203
|
describe "load_file" do
|