vcard 0.2.14 → 0.2.15

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: dab62931019aa50589848685e0ece97fce22a816
4
- data.tar.gz: da5844c2ec7d8fff390055b6ae247845d0c4111f
3
+ metadata.gz: 7bf5d808360f93f671721cdfe17d1e5c96b802d2
4
+ data.tar.gz: 06944b096cbebd0121e4f78086c6c81fd6f49950
5
5
  SHA512:
6
- metadata.gz: cfd6decb35dcd2a61aea730f5ded93c7555c1a5cb1796a98fcf897172f8f3b0e4116f4021efb4924d803132223ed875833dc96c55504058b7bf30cb46703a22c
7
- data.tar.gz: 986f18eb24dea4885a53916969fe7161dc8dd05f0b291614250a1106ebc09453c742f45210a4fcc2b2fb22cd80425ef41f139878a679b4db6e9f45da9cca3773
6
+ metadata.gz: 2936818e7f3b42d0708f6b2d20390b5fc286176c180f802b311f12bc6f83cc6abab5df93bfe2e58e33f86c7758fa456e437ef2a486d5d85a10f5d9fc4e6f70da
7
+ data.tar.gz: fec1505251159775098a6b46bc742c5b4f19d538d18bc72ab05ecb718e1a35040a327bbc7c5d80e5e699bebccdeda454aadfc9bfb3848c3948c795d1f78a4e92
data/lib/vcard.rb CHANGED
@@ -287,11 +287,11 @@ module Vcard
287
287
  return outer, inner
288
288
  end
289
289
 
290
- def configuration
290
+ def self.configuration
291
291
  @configuration ||= Configuration.new
292
292
  end
293
293
 
294
- def configure
294
+ def self.configure
295
295
  yield configuration
296
296
  end
297
297
 
@@ -8,8 +8,18 @@ module Vcard
8
8
  alias_method :ignore_invalid_vcards?, :ignore_invalid_vcards
9
9
 
10
10
  def initialize
11
- @raise_on_invalid = true
12
- @ignore_invalid_vcard = true
11
+ set_default_values
12
+ end
13
+
14
+ def reset
15
+ set_default_values
16
+ end
17
+
18
+ private
19
+
20
+ def set_default_values
21
+ @raise_on_invalid_line = true
22
+ @ignore_invalid_vcards = true
13
23
  end
14
24
 
15
25
  end
data/lib/vcard/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vcard
2
- VERSION = "0.2.14"
2
+ VERSION = "0.2.15"
3
3
  end
@@ -0,0 +1,23 @@
1
+ require "test_helper"
2
+
3
+ class ConfigurationTest < Test::Unit::TestCase
4
+ def test_should_be_an_instance_of_configuration
5
+ assert Vcard.configuration.is_a?(::Vcard::Configuration)
6
+ end
7
+
8
+ def test_have_default_values
9
+ Vcard.configuration.reset
10
+ assert_equal(Vcard.configuration.raise_on_invalid_line, true)
11
+ assert_equal(Vcard.configuration.ignore_invalid_vcards, true)
12
+ end
13
+
14
+ def test_allow_configuration_with_block
15
+ Vcard.configuration.reset
16
+ Vcard.configure do |config|
17
+ config.raise_on_invalid_line = false
18
+ config.ignore_invalid_vcards = false
19
+ end
20
+ assert_equal(Vcard.configuration.raise_on_invalid_line, false)
21
+ assert_equal(Vcard.configuration.ignore_invalid_vcards, false)
22
+ end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14
4
+ version: 0.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuba Kuźma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-22 00:00:00.000000000 Z
11
+ date: 2016-12-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Vcard extracted from Vpim
14
14
  email:
@@ -35,6 +35,7 @@ files:
35
35
  - lib/vcard/field.rb
36
36
  - lib/vcard/vcard.rb
37
37
  - lib/vcard/version.rb
38
+ - test/configuration_test.rb
38
39
  - test/field_test.rb
39
40
  - test/fixtures/bday_decode.vcard
40
41
  - test/fixtures/bday_decode_2.vcard
@@ -90,6 +91,7 @@ signing_key:
90
91
  specification_version: 4
91
92
  summary: Vcard extracted from Vpim
92
93
  test_files:
94
+ - test/configuration_test.rb
93
95
  - test/field_test.rb
94
96
  - test/fixtures/bday_decode.vcard
95
97
  - test/fixtures/bday_decode_2.vcard