eml_to_pdf 0.3.1 → 0.4.0

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: 6793a974d1c21ca4111d35748618561577092d74
4
- data.tar.gz: 5bb5faf4e3725923161ff12c51cd00a3f1fb6a0e
3
+ metadata.gz: 8066ee85637834e40eabff881ca5dc0c507dfeec
4
+ data.tar.gz: 482c532373eebd9c8ac1dd53c8855d05c0f03e4d
5
5
  SHA512:
6
- metadata.gz: a6e0208d5407448a2a9cfb5d3f008b089bb944527190902d559be35ab07c98365c6d5f0b1c4943a3dfa9379200147cb07193646dbcfed60f4fd27d957549275b
7
- data.tar.gz: 08ff12425d51a5d4ea1c095a017d39e86d8f9decfffbc44c874804118a6cc5585d3337f60da54d9df15d1920dea5d089294138340b5d26885ee4e6eb77abf5aa
6
+ metadata.gz: a966380147ebf6245004730e86b042738346d5b426ba839fe96613bb575a090887e108b6fee5149a7991a1edd167a798f88e8d050678096e85c14646d3ad2776
7
+ data.tar.gz: 4955d0bc20a0ad90c44fa2b00a70814cb66dd316f7e765fef4e2d4efd57337c83d72a8a92ea6420cced9a6e90a2e972a46d987004f3871f01566cf87b877a139
@@ -1,4 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.2.2
4
- before_install: gem install bundler -v 1.10.6
4
+ before_install:
5
+ - gem install bundler -v 1.10.6
6
+ - wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
7
+ - tar -xvf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
8
+ - export PATH=$PATH:$PWD/wkhtmltox/bin/
data/README.md CHANGED
@@ -34,7 +34,9 @@ EmlToPdf.configure do |config|
34
34
  config.to_label = "To =>"
35
35
  config.cc_label = "Cc =>"
36
36
  config.date_label = "Date =>"
37
- config.date_format = "%d.%m.%Y" # see Date#strftime
37
+ config.date_format do |date|
38
+ date.strftime("%Y")
39
+ end
38
40
  end
39
41
  ```
40
42
 
@@ -1,22 +1,25 @@
1
1
  module EmlToPdf
2
2
  class Configuration
3
3
  attr_accessor :from_label, :to_label, :cc_label, :date_label
4
- attr_reader :date_format
5
4
 
6
5
  def initialize
7
6
  @from_label = "From"
8
7
  @to_label = "To"
9
8
  @cc_label = "Cc"
10
9
  @date_label = "Date"
11
- @date_format = "%Y-%m-%d %H:%M:%S %z"
10
+ @date_format = lambda { |date| date.strftime("%Y-%m-%d %H:%M:%S %z") }
12
11
  end
13
12
 
14
- def date_format=(value)
15
- if value.is_a?(String)
16
- @date_format = value
13
+ def date_format(&block)
14
+ if block_given?
15
+ @date_format = block
17
16
  else
18
- raise ArgumentError, "You can only use a String to format the date. (See Date#strftime)"
17
+ @date_format
19
18
  end
20
19
  end
20
+
21
+ def format_date(date)
22
+ @date_format.call(date)
23
+ end
21
24
  end
22
25
  end
@@ -18,7 +18,7 @@ module EmlToPdf
18
18
  end
19
19
 
20
20
  def format_date(date)
21
- date.strftime(config.date_format)
21
+ config.format_date(date)
22
22
  end
23
23
 
24
24
  def html_escape(str)
@@ -1,3 +1,3 @@
1
1
  module EmlToPdf
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eml_to_pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yves Siegrist
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-10 00:00:00.000000000 Z
11
+ date: 2016-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler