mangdown 0.13.3 → 0.13.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b4edce6f4511a5513de3fc39acbee0bbadeb6a7
4
- data.tar.gz: 10f48a8789a42a744029aa07812a6d506d0388ae
3
+ metadata.gz: 1b46ede1b55f92c1ff03e43c64890bcb77f98838
4
+ data.tar.gz: ce4927534522cc6bf0ab39deece40bb58d7524d8
5
5
  SHA512:
6
- metadata.gz: 1af096493c7ea75518ec6e7ddfd8c802d9f8af70744828b6573269f7dfcc0e2d990dc3fffa3780773cab1b79622ab49442dd1b236622e2614efc6c6d26cbea9c
7
- data.tar.gz: 2dacfd63034bb0f519e7cc414573e363d3337f3fa1259ad1e7d3648173541af4c91df9acefa090ec8d80b68817f1daa251d3c81bdd746dd33164b0b221f460c1
6
+ metadata.gz: 669578148a673bdd314a4f49cb541947e473d9286e907f51effc28e298d877ac56f68c44830c4c6b123732deacb289395d96bf13245d5f2db28d8e61305748f1
7
+ data.tar.gz: c4e48d29330badd3ebd2166262b6fa62783b0ce614ccac4907ec7b7e2c4259618aa16c8535d0498770451ee507bc5f8f33f599757235573063eb0c5145e7a0c9
data/lib/mangdown/page.rb CHANGED
@@ -6,7 +6,7 @@ module Mangdown
6
6
  attr_reader :uri, :name, :manga, :chapter
7
7
 
8
8
  def initialize(uri, name, manga, chapter)
9
- @name = name
9
+ @name = Tools.valid_path_name(name)
10
10
  @chapter = chapter
11
11
  @manga = manga
12
12
  @uri = Mangdown::Uri.new(uri)
@@ -21,14 +21,16 @@ module Mangdown
21
21
  @path ||= set_path
22
22
  end
23
23
 
24
+ # Set path of page to file path if a file exists or to path
25
+ # without file extension if file is not found. File extensions
26
+ # are appended only after the file has been downloaded.
24
27
  def set_path(dir = nil)
25
28
  dir ||= File.join(manga, chapter)
26
29
  dir = Tools.valid_path_name(dir)
27
- path = File.join(dir, name)
28
30
  if Dir.exist?(dir)
29
- path = Dir.entries(dir).find { |file| file.to_s[path] } || path
31
+ file = Dir.entries(dir).find { |file| file[name] }
30
32
  end
31
- path = Tools.valid_path_name(path)
33
+ path = File.join(dir, file || name)
32
34
  @path = Tools.relative_or_absolute_path(path)
33
35
  end
34
36
 
@@ -1,3 +1,3 @@
1
1
  module Mangdown
2
- VERSION = "0.13.3"
2
+ VERSION = "0.13.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mangdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 0.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - jphager2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-05 00:00:00.000000000 Z
11
+ date: 2016-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday