fast_attributes-uuid 0.0.5 → 0.0.6

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: 31ea45e99aaea18c327a316defad9cdd8586351b
4
- data.tar.gz: b2bd2caf12b2d89e7fbd486f650c39ed6702ffab
3
+ metadata.gz: 80d79d6af52dbcb6679d6ba7e58b15fc74fc39b3
4
+ data.tar.gz: 0e6685b8b1f7682384813f5688cb733803331d30
5
5
  SHA512:
6
- metadata.gz: 614232405960e00bb58c358bc8a3e5eeb54a4b48849b06d8449e00f7adb8856a6a06aaafa065bb4b934ce91bcf0ac0c40e3599d205d7e17bf5d52c5d35f6f285
7
- data.tar.gz: e429757b3104a78b974e8330af6f1b82b9d4b90e578a9b6a9298f212319a7a0bb88f8980bfdffe20aef88c8eb371a74fd42209e098392111ad21b37510ef1a0c
6
+ metadata.gz: 7265afe1a556f5448a3171d707c6a1b94cb3ac971b561f936ef6e54f176aaf10270d33d46a675734d28e61aaefb723468cc0184b2551634929faa034ad782972
7
+ data.tar.gz: 8a0406a00d88c465a459a62fa8df63a72faff455b3c28c55b0f4786f9ec862100803e435b246985aaa6f2f7216aaeddb3ae53e4c6b85e50e97d9316f34b1744d
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ script: bundle exec rspec spec
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.1
@@ -0,0 +1,14 @@
1
+ **0.0.5 (July 20, 2014)**
2
+ * Support `fast_attributes` 0.6.0
3
+
4
+ **0.0.4 (July 16, 2014)**
5
+ * Support `fast_attributes` 0.5.0
6
+
7
+ **0.0.3 (July 4, 2014)**
8
+ * Support `fast_attributes` 0.3.0
9
+
10
+ **0.0.2 (July 4, 2014)**
11
+ * Support `fast_attributes` 0.2.2
12
+
13
+ **0.0.1 (June 27, 2014)**
14
+ * Initial commit
data/README.md CHANGED
@@ -1,28 +1,56 @@
1
1
  # FastAttributes::UUID
2
+ [![Gem Version](http://img.shields.io/gem/v/fast_attributes-uuid.svg)](http://rubygems.org/gems/fast_attributes-uuid)
3
+ [![Build Status](http://img.shields.io/travis/applift/fast_attributes-uuid.svg)](https://travis-ci.org/applift/fast_attributes-uuid)
4
+ [![Coverage Status](http://img.shields.io/coveralls/applift/fast_attributes-uuid.svg)](https://coveralls.io/r/applift/fast_attributes-uuid?branch=master)
5
+ [![Code Climate](http://img.shields.io/codeclimate/github/applift/fast_attributes-uuid.svg)](https://codeclimate.com/github/applift/fast_attributes-uuid)
6
+ [![Dependency Status](http://img.shields.io/gemnasium/applift/fast_attributes-uuid.svg)](https://gemnasium.com/applift/fast_attributes-uuid)
2
7
 
3
- TODO: Write a gem description
8
+ ## Overview
9
+ This gem adds support of `UUID` type to `fast_attributes` gem
4
10
 
5
11
  ## Installation
6
12
 
7
13
  Add this line to your application's Gemfile:
8
-
9
- gem 'fast_attributes-uuid'
14
+ ```ruby
15
+ gem 'fast_attributes'
16
+ gem 'fast_attributes-uuid'
17
+ ```
10
18
 
11
19
  And then execute:
12
-
13
- $ bundle
20
+ ```
21
+ $ bundle
22
+ ```
14
23
 
15
24
  Or install it yourself as:
16
-
17
- $ gem install fast_attributes-uuid
25
+ ```
26
+ $ gem install fast_attributes fast_attributes-uuid
27
+ ```
18
28
 
19
29
  ## Usage
20
30
 
21
- TODO: Write usage instructions here
31
+ ```ruby
32
+ require 'fast_attributes'
33
+ require 'fast_attributes/uuid'
34
+
35
+ class Request
36
+ extend FastAttributes
37
+ attribute :id, UUIDTools::UUID
38
+ end
39
+
40
+ request = Request.new
41
+ request.id = '479c4718-06d0-4712-b79d-eea7170938c8'
42
+ # => #<UUID:0x3ff8a1a0a684 UUID:479c4718-06d0-4712-b79d-eea7170938c8>
43
+
44
+ request.id = 'EFC0CCF6E72243958306D816AB82BAB7'
45
+ # => #<UUID:0x3ff8a19db924 UUID:efc0ccf6-e722-4395-8306-d816ab82bab7>
46
+
47
+ request.id = UUIDTools::UUID.parse('4e79aff3-1f04-4fea-bebf-694625551a92')
48
+ # => #<UUID:0x3ff8a19c3d24 UUID:4e79aff3-1f04-4fea-bebf-694625551a92>
49
+ ```
22
50
 
23
51
  ## Contributing
24
52
 
25
- 1. Fork it ( https://github.com/[my-github-username]/fast_attributes-uuid/fork )
53
+ 1. Fork it ( https://github.com/applift/fast_attributes-uuid/fork )
26
54
  2. Create your feature branch (`git checkout -b my-new-feature`)
27
55
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
56
  4. Push to the branch (`git push origin my-new-feature`)
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = '>= 1.9.2'
22
22
 
23
- spec.add_runtime_dependency 'fast_attributes', '~> 0.6.0'
23
+ spec.add_runtime_dependency 'fast_attributes', '~> 0.7.0'
24
24
  spec.add_runtime_dependency 'uuidtools', '~> 2.1.4'
25
25
 
26
26
  spec.add_development_dependency 'bundler', '~> 1.6'
@@ -5,14 +5,18 @@ module FastAttributes
5
5
  module UUID
6
6
  end
7
7
 
8
- set_type_casting UUIDTools::UUID, <<-EOS.gsub(/^\s*/, '')
9
- case %s.length
10
- when 36 then UUIDTools::UUID.parse(%s)
11
- when 32 then UUIDTools::UUID.parse_hexdigest(%s)
12
- when 0 then nil
13
- else UUIDTools::UUID.parse_raw(%s)
14
- end
15
- EOS
8
+ type_cast UUIDTools::UUID, :uuid do
9
+ from 'nil', to: 'nil'
10
+ from 'UUIDTools::UUID', to: '%s'
11
+ otherwise <<-EOS
12
+ case %s.length
13
+ when 36 then UUIDTools::UUID.parse(%s)
14
+ when 32 then UUIDTools::UUID.parse_hexdigest(%s)
15
+ when 0 then nil
16
+ else UUIDTools::UUID.parse_raw(%s)
17
+ end
18
+ EOS
19
+ end
16
20
  end
17
21
 
18
22
  require 'fast_attributes/uuid/version'
@@ -1,5 +1,5 @@
1
1
  module FastAttributes
2
2
  module UUID
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
5
5
  end
@@ -46,4 +46,11 @@ describe FastAttributes::UUID do
46
46
  expect(log.request_id).to be_a(UUIDTools::UUID)
47
47
  expect(log.request_id.to_s).to eq('d2b4b3e3-4f16-4aa8-bc43-cab90d008171')
48
48
  end
49
+
50
+ it 'allows to define attribute using symbol notation' do
51
+ log = SymbolUUID.new
52
+ log.request_id = 'd2b4b3e3-4f16-4aa8-bc43-cab90d008171'
53
+ expect(log.request_id).to be_a(UUIDTools::UUID)
54
+ expect(log.request_id.to_s).to eq('d2b4b3e3-4f16-4aa8-bc43-cab90d008171')
55
+ end
49
56
  end
@@ -4,3 +4,10 @@ class Log
4
4
  attribute :method, String
5
5
  attribute :request_id, UUIDTools::UUID
6
6
  end
7
+
8
+ class SymbolUUID
9
+ extend FastAttributes
10
+
11
+ attribute :method, :string
12
+ attribute :request_id, :uuid
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_attributes-uuid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kostiantyn Stepaniuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-20 00:00:00.000000000 Z
11
+ date: 2014-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fast_attributes
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.0
19
+ version: 0.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.6.0
26
+ version: 0.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: uuidtools
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +89,8 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".gitignore"
91
91
  - ".rspec"
92
+ - ".travis.yml"
93
+ - CHANGELOG.md
92
94
  - Gemfile
93
95
  - LICENSE.txt
94
96
  - README.md