projects
/
quanlib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add `arrived` attribute (file creation timestamp) to books table.
[quanlib.git]
/
cover.rb
diff --git
a/cover.rb
b/cover.rb
index b00d002dfdac8439857b08833738485510ed7376..e74c27ba6cc42726f69804fd3ac3904b715aa5cc 100644
(file)
--- a/
cover.rb
+++ b/
cover.rb
@@
-1,7
+1,13
@@
class Cover
class Cover
+ attr_reader :path
+
def initialize(inputStream, path, mimeType)
def initialize(inputStream, path, mimeType)
- @data = inputStream.read
+ if nil != inputStream
+ @data = inputStream.read
+ else
+ @data = nil
+ end
@path = path
@mimeType = mimeType
end
@path = path
@mimeType = mimeType
end
@@
-32,8
+38,7
@@
class Cover
return inspect
end
return inspect
end
- def write_image(outputDir, baseName)
- filename = baseName + getExt()
+ def write_image(outputDir, filename)
open(outputDir + '/' + filename, 'wb') do |fd|
fd.write(@data)
end
open(outputDir + '/' + filename, 'wb') do |fd|
fd.write(@data)
end