eepub 0.1.1 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e63fc3fc413513bf8e0a5a76138bc3c45cb4b503
4
- data.tar.gz: 64faf6bff88d27de606224c8c8cf48f6ab3e4b7d
3
+ metadata.gz: 17b04605903997480b36c48aa960bf80095fb696
4
+ data.tar.gz: 195e16dfea1d1fb68d9bd457a48aa31405048e54
5
5
  SHA512:
6
- metadata.gz: 30427222b855fb5eff2cab31b11b3da1a013865825ca2899c62e4e61c08466d69c54c2007ecbd8e4e43523f0e4863bda391f7df2f932382f556f26d01faa26f1
7
- data.tar.gz: 53bf9c813c76079bb35a29e87ada277be5335ff0a28598907ca7b1fe0266bf3fc3423121ea2178c65405b35a6c36d98e43f9c463cf9508b9f8388629e42fa48a
6
+ metadata.gz: 18a2a82aa4336a89d8d2ad72819db5d6cae49a1daec5ecd990652544b14b7c3dbb198b283add247ca98af050c4ccc7587f01fc8e2e6575369ad1112eda9f53f4
7
+ data.tar.gz: 777e60cd6b7373f3297ca3919052c77af2eaad3113d65439d7a297ea9c962db5f424577c46489c5c63f3f5218b0f96be59883f9795a760a435ee4a253c528b7e
data/README.md CHANGED
@@ -28,7 +28,11 @@ epub = Eepub.load_from('path/to/example.epub')
28
28
  epub.title #=> 'Example book'
29
29
  epub.title = 'UPDATED'
30
30
 
31
- epub.save_to 'path/to/updated.epub'
31
+ # in-place update
32
+ epub.save!
33
+
34
+ # save to another file
35
+ epub.save! to: 'path/to/updated.epub'
32
36
  ```
33
37
 
34
38
  ## Development
data/lib/eepub/epub.rb CHANGED
@@ -8,6 +8,8 @@ module Eepub
8
8
  @path = path
9
9
  end
10
10
 
11
+ attr_reader :path
12
+
11
13
  def title
12
14
  @title ||= Zip::File.open(@path) {|zip|
13
15
  package_xml = Nokogiri::XML.parse(package_entry(zip).get_input_stream)
@@ -18,10 +20,10 @@ module Eepub
18
20
 
19
21
  attr_writer :title
20
22
 
21
- def save_to(dest_path)
22
- FileUtils.cp @path, dest_path unless @path == dest_path
23
+ def save!(to: path)
24
+ FileUtils.cp path, to unless path == to
23
25
 
24
- Zip::File.open dest_path do |zip|
26
+ Zip::File.open to do |zip|
25
27
  entry = package_entry(zip)
26
28
  xml = Nokogiri::XML.parse(entry.get_input_stream)
27
29
  title_node = xml.at_xpath('//dc:title', dc: 'http://purl.org/dc/elements/1.1/')
data/lib/eepub/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eepub
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eepub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Urashima