mbox_header_scraper 0.1.0 → 0.1.1

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: 7be5524c12492b10eb63bfad40bac97efbce5ca3
4
- data.tar.gz: 482a7926ad5e837d475b7615c3c60ee029b790bd
3
+ metadata.gz: 571ffc1de1d8b9eddb747fccfd8236ded016f6e3
4
+ data.tar.gz: ee30ac56960fdaf9f4e8ad03fa5e96dabfee2680
5
5
  SHA512:
6
- metadata.gz: 07e78ca647f47a93066b03bcceaa2dbb9a357103313ee780a74fc31d2f5fef5ae844073b1a58998476b162a98cf9839cc8cb26797daaa6c5d2583c0e89d6c3fa
7
- data.tar.gz: 7dbd55635c648fe3feab7b730ec38f8db04a0339b49d323c3531d3c9a5d766c8c888f3daf7f5ebfbef1e1f3b7a25f098bc1cddd756c2f9ca84694b7ab8916aa9
6
+ metadata.gz: e208c4676849490b7ac4431ec3dae096521d726751ded5e5b57e36d713bc86bd95cad3a576ca3daffbe72b3956063d9ff7542ad1601fe18991c40b36b2cfea5f
7
+ data.tar.gz: 3b43e79c6fdfdf63cd90dcf3f01139a9e942c44e854ac99e15df9a43376a92842e9fc8b424bf19475ec6bba643014b2d0ccd7e0ce82e6f16889e8106028e3654
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MboxHeaderScraper
2
2
 
3
- [![Circle CI](https://circleci.com/gh/tamano/mbox_header_scraper.svg?style=svg)](https://circleci.com/gh/tamano/mbox_header_scraper) [![Code Climate](https://codeclimate.com/github/tamano/mbox_header_scraper/badges/gpa.svg)](https://codeclimate.com/github/tamano/mbox_header_scraper) [![Test Coverage](https://codeclimate.com/github/tamano/mbox_header_scraper/badges/coverage.svg)](https://codeclimate.com/github/tamano/mbox_header_scraper)
3
+ [![Gem Version](https://badge.fury.io/rb/mbox_header_scraper.svg)](http://badge.fury.io/rb/mbox_header_scraper) [![Circle CI](https://circleci.com/gh/tamano/mbox_header_scraper.svg?style=svg)](https://circleci.com/gh/tamano/mbox_header_scraper) [![Code Climate](https://codeclimate.com/github/tamano/mbox_header_scraper/badges/gpa.svg)](https://codeclimate.com/github/tamano/mbox_header_scraper) [![Test Coverage](https://codeclimate.com/github/tamano/mbox_header_scraper/badges/coverage.svg)](https://codeclimate.com/github/tamano/mbox_header_scraper)
4
4
 
5
5
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/mbox_header_scraper`. To experiment with that code, run `bin/console` for an interactive prompt.
6
6
 
@@ -75,7 +75,7 @@ class MboxHeaderScraper::Mail
75
75
  end
76
76
 
77
77
  def get_if_matched(param, line)
78
- return nil unless /^#{param}: / =~ line
78
+ return nil unless /^#{param}: /i =~ line
79
79
 
80
80
  if param == :Subject
81
81
  subject = NKF.nkf('-mw', ($'))
@@ -13,14 +13,18 @@ class MboxHeaderScraper::Scraper
13
13
  end
14
14
 
15
15
  IO.foreach(in_file) do |line|
16
- if /^From / =~ line && !tmp.closed?
16
+ # encode to convert invalid charcter
17
+ enc_line = line.encode('UTF-16BE', 'UTF-8',
18
+ invalid: :replace, undef: :replace, replace: '?').encode('UTF-8')
19
+
20
+ if /^From / =~ enc_line && !tmp.closed?
17
21
  tmp.close(false)
18
22
  result_file.write(single_mail_to_tsv(tmp, options))
19
23
  tmp.delete
20
24
  end
21
25
 
22
26
  tmp = Tempfile.open('mbox_header_scraper_tmp') if tmp.closed?
23
- tmp.write(line)
27
+ tmp.write(enc_line)
24
28
  end
25
29
 
26
30
  tmp.close(false)
@@ -1,4 +1,4 @@
1
1
  # About Version
2
2
  module MboxHeaderScraper
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mbox_header_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuya TAMANO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-24 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor