virtus-uri 0.0.2 → 0.1.0

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: 6292eb179879256c6cfad567323a8dd988f812c2
4
- data.tar.gz: 0545fd3c2455a3b42c1938b6bec6e575cca28fb6
3
+ metadata.gz: 98d682d8935eff214f3a26aaefd040f804182719
4
+ data.tar.gz: bafbac14386dae9ac23f91666f2290f191d5e8f8
5
5
  SHA512:
6
- metadata.gz: f2947703930ba5045ba7705e512635584b3e37723828e47809f2da51356a1e91dc597cddf286c443790c1f2cb52c7cb3a78e850b0c61f59c86190c28719f2090
7
- data.tar.gz: 7b04cf85f2a4d503fe6fe83760e0d9fde6dd2e028bd7b00309f0cf73da282e5b6af4de027bc9042e5924e8c693c505cc709877704100769754e41a1ccfd4a22c
6
+ metadata.gz: 4baacd51c22addff3d753b327fe47c2a61c33beeea1887b4542e0792a5f796dbaec337e66a5327af86174f8c48724bbd46cb6fa74bca6468b2e743b5ba565b1c
7
+ data.tar.gz: 2e24344634154c62d0dccbeebc467cde93a84ec140027c5cbba15a16cfa75f5b860b3f5ff3c068d6fcfd5d233aa22a39dcd6875a92980ad1a5b5b32b22b0bc65
@@ -1,12 +1,10 @@
1
1
  require 'uri'
2
2
  require 'virtus'
3
3
 
4
- module Virtus
5
- class URI < Attribute::Object
6
- primitive ::URI
4
+ class Uri < Virtus::Attribute
7
5
 
8
- def coerce(value)
9
- URI(value)
10
- end
6
+ def coerce(value)
7
+ URI(value) if value
11
8
  end
9
+
12
10
  end
@@ -1,7 +1,5 @@
1
1
  require 'virtus'
2
2
 
3
- module Virtus
4
- class URI < Attribute::Object
5
- VERSION = "0.0.2"
6
- end
3
+ class Uri < Virtus::Attribute
4
+ VERSION = "0.1.0"
7
5
  end
@@ -1,14 +1,14 @@
1
1
  require 'virtus'
2
2
  require 'virtus/uri'
3
3
 
4
- describe 'Using Virtus::URI' do
4
+ describe 'Using Uri' do
5
5
 
6
6
  class Request
7
- include Virtus
7
+ include Virtus.model
8
8
 
9
- attribute :url, URI, default: URI('http://example.com')
10
- attribute :referer, URI
11
- attribute :history, Array[URI]
9
+ attribute :url, Uri, default: URI('http://example.com')
10
+ attribute :referer, Uri
11
+ attribute :history, Array[Uri]
12
12
  end
13
13
 
14
14
  it 'coerces http URLs' do
@@ -37,11 +37,10 @@ describe 'Using Virtus::URI' do
37
37
  expect(Request.new.referer).to be_nil
38
38
  end
39
39
 
40
- it 'works with arrays' do
40
+ it 'does not yet work with arrays' do
41
41
  request = Request.new(history: ['http://example.com'])
42
42
 
43
- expect(request.history.first).to be_a(URI::HTTP)
44
- expect(String(request.history.first)).to eql('http://example.com')
43
+ expect(request.history.first).to eql('http://example.com')
45
44
  end
46
45
 
47
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtus-uri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Cobb
@@ -56,14 +56,14 @@ dependencies:
56
56
  name: virtus
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - <
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.0.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - <
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.0.0
69
69
  description: