chupa-text-decomposer-pdf 1.0.3 → 1.0.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: '083dd5ec66cd3d8859092f81abcc0d3e5c6f3929'
4
- data.tar.gz: 8ec37a765b3402bf97f3f93a5ef5748aa8257499
3
+ metadata.gz: c22ec29af1551ea0f0b191604892bd822d789ff9
4
+ data.tar.gz: b7bdb38c1a591eb73c6ccbaedf98b2d6e99fc4cb
5
5
  SHA512:
6
- metadata.gz: 3114a7e40b3c25cca8294337108276b1f204224bf8e815201145ab97959eac8387aacbb2c786860732624e2ec282be98793c00b4a9b8e6546eb60cc122cbc0d1
7
- data.tar.gz: c68f85e85556afa87c7926c862ab3bb429439048220738b8aeb33798bcb125b9729a175c98ac4f8bf3cb17837734776f6e9a18fb4b86460ff049875183c2e967
6
+ metadata.gz: a73016b65242e1b3fc3fc3f3ea9ec12cf1523ebdae32ccc386793a3622688a2a4934dee94cd6bf3a907f1515f601a2f26202955a00d852c669ca07dab975fa7c
7
+ data.tar.gz: 9af603e00307e9b68204cafcd2bb56263f8d62f250b893a1d642e055919f8983ac2cb5712f225b1492ae8ab7de8bed8d7fd92616531cf16cb76a548bc3a92e01
@@ -22,7 +22,7 @@ end
22
22
 
23
23
  Gem::Specification.new do |spec|
24
24
  spec.name = "chupa-text-decomposer-pdf"
25
- spec.version = "1.0.3"
25
+ spec.version = "1.0.4"
26
26
  spec.homepage = "https://github.com/ranguba/chupa-text-decomposer-pdf"
27
27
  spec.authors = ["Kouhei Sutou"]
28
28
  spec.email = ["kou@clear-code.com"]
@@ -1,5 +1,11 @@
1
1
  # News
2
2
 
3
+ ## 1.0.4: 2017-07-05
4
+
5
+ ### Improvements
6
+
7
+ * Supported content based detection for no extension input.
8
+
3
9
  ## 1.0.3: 2017-05-02
4
10
 
5
11
  ### Improvements
@@ -24,8 +24,16 @@ module ChupaText
24
24
  registry.register("pdf", self)
25
25
 
26
26
  def target?(data)
27
- (data.extension == "pdf" and data.body.start_with?("%PDF-1")) or
28
- data.mime_type == "application/pdf"
27
+ return true if data.mime_type == "application/pdf"
28
+
29
+ return false if data.body.nil?
30
+
31
+ case data.extension
32
+ when nil, "pdf"
33
+ data.body.start_with?("%PDF-1")
34
+ else
35
+ false
36
+ end
29
37
  end
30
38
 
31
39
  def decompose(data)
@@ -35,7 +35,7 @@ class TestPDF < Test::Unit::TestCase
35
35
  sub_test_case("extension") do
36
36
  def create_data(uri)
37
37
  data = ChupaText::Data.new
38
- data.body = ""
38
+ data.body = "%PDF-1.4"
39
39
  data.uri = uri
40
40
  data.mime_type = "application/octet-stream"
41
41
  data
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chupa-text-decomposer-pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
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-05-02 00:00:00.000000000 Z
11
+ date: 2017-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chupa-text