chupa-text 1.0.7 → 1.0.8

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: 9a50556c287fd5148a3032b4fd8518679237e7be
4
- data.tar.gz: 0d58a4948b3df081449e67211e23168b539be83b
3
+ metadata.gz: 996c7628251b6467736c48363ff31cf3b2eedb8a
4
+ data.tar.gz: 53a0af15b4e03a8f59747bdbc30ff49209bdd796
5
5
  SHA512:
6
- metadata.gz: 298a7416122a757fbb6018c73327f768adaa6b18402f7725e5c9dde12b320d00a7015c04a5eb90580b4c6f822678acded64e132a8ba9d8d1b1de792804d13103
7
- data.tar.gz: 3aaaa8b120e085434094163d3e582cb4bb33c5478a2916a268cd5b03cfff10b48cd05f6912acb26185e288650cc656a3f38260a48468fd988de74f0dff59bc1e
6
+ metadata.gz: e62ddb8fac42f82f1dea609b18fee3102ce4019a1e93d04dccc72505a14f5a2fb0b722a210cffb67a0cfa3857ae2af480137cd21ddb3624accf5ce9349e9a13f
7
+ data.tar.gz: 20496a45e2bee52e16d081a4fbdd3d41dd477183e82bd086a945ffc61ea955ece66d0a3e6094b324070315af3dd34375898bd9450e7bb801195b52a645ff9e7d
data/doc/text/news.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # News
2
2
 
3
+ ## 1.0.8: 2017-07-10
4
+
5
+ ### Improvements
6
+
7
+ * `ChupaText::VirtualContent`: Accepted `Pathname`.
8
+
9
+ ### Fixes
10
+
11
+ * `ChupaText::VirtualFileData#path`: Fixed a bug that it doesn't
12
+ return real path.
13
+
3
14
  ## 1.0.7: 2017-07-06
4
15
 
5
16
  ### Improvements
@@ -121,7 +121,7 @@ module ChupaText
121
121
  end
122
122
  file_uri = "file://#{file_uri}"
123
123
  @uri = URI.parse(file_uri)
124
- self.path ||= uri
124
+ self.path = uri
125
125
  when NilClass
126
126
  @uri = nil
127
127
  self.path = nil
@@ -130,7 +130,7 @@ module ChupaText
130
130
  uri = URI.parse(uri)
131
131
  end
132
132
  @uri = uri
133
- self.path ||= @uri.path
133
+ self.path = @uri.path
134
134
  end
135
135
  end
136
136
 
@@ -81,8 +81,8 @@ module ChupaText
81
81
  debug do
82
82
  "#{log_tag}[extract][decomposed] " +
83
83
  "#{decomposer.class}: " +
84
- "<#{target.uri}>:<#{target.mime_type}> -> " +
85
- "<#{decomposed.mime_type}>"
84
+ "<#{target.uri}>: " +
85
+ "<#{target.mime_type}> -> <#{decomposed.mime_type}>"
86
86
  end
87
87
  targets.push(decomposed)
88
88
  end
@@ -15,5 +15,5 @@
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
  module ChupaText
18
- VERSION = "1.0.7"
18
+ VERSION = "1.0.8"
19
19
  end
@@ -14,6 +14,7 @@
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
+ require "pathname"
17
18
  require "stringio"
18
19
  require "tempfile"
19
20
 
@@ -25,6 +26,13 @@ module ChupaText
25
26
  attr_reader :size
26
27
  def initialize(input, original_path=nil)
27
28
  @file = nil
29
+ if original_path.is_a?(String)
30
+ if original_path.empty?
31
+ original_path = nil
32
+ else
33
+ original_path = Pathname.new(original_path)
34
+ end
35
+ end
28
36
  @base_name = compute_base_name(original_path)
29
37
  @body = nil
30
38
  setup_file do |file|
@@ -47,7 +55,7 @@ module ChupaText
47
55
  private
48
56
  def compute_base_name(original_path)
49
57
  if original_path
50
- prefix, suffix = File.basename(original_path).split(/(\.[^.]+\z)/)
58
+ prefix, suffix = original_path.basename.to_s.split(/(\.[^.]+\z)/)
51
59
  if suffix
52
60
  [prefix, suffix]
53
61
  else
@@ -20,6 +20,7 @@ module ChupaText
20
20
  super(options)
21
21
  self.uri = uri
22
22
  @content = VirtualContent.new(input, path)
23
+ self.path = @content.path
23
24
  end
24
25
 
25
26
  def body
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chupa-text
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-06 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler