fast_attributes-uuid 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fast_attributes-uuid.gemspec +1 -1
- data/lib/fast_attributes/uuid.rb +4 -5
- data/lib/fast_attributes/uuid/version.rb +1 -1
- data/spec/fast_attributes/uuid_spec.rb +14 -15
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12d3d7b7d5353c6b6a2d8380bdbe94e5da045b2c
|
4
|
+
data.tar.gz: f59662c6292cea38b677f6defdea69ca9a0fb957
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6afae3334e2f2a45c33aea24a6c553ce6e55421ad693e21390c8937496003631147e6201df91446d6e1274e8c33c6e778dc57eb8067e7b9b110b544e650c3935
|
7
|
+
data.tar.gz: 4f653549a7f566751daf64e14956b62fbbba1d206852d28fb6876d084a6b9d285f73999306cb572711f68ea47322a863d9f96ff8116988f66ec89dac71737b94
|
@@ -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.
|
23
|
+
spec.add_runtime_dependency 'fast_attributes', '~> 0.5.0'
|
24
24
|
spec.add_runtime_dependency 'uuidtools', '~> 2.1.4'
|
25
25
|
|
26
26
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
data/lib/fast_attributes/uuid.rb
CHANGED
@@ -6,12 +6,11 @@ module FastAttributes
|
|
6
6
|
end
|
7
7
|
|
8
8
|
set_type_casting UUIDTools::UUID, <<-EOS.gsub(/^\s*/, '')
|
9
|
-
|
10
|
-
|
11
|
-
when
|
12
|
-
when 32 then UUIDTools::UUID.parse_hexdigest(_value)
|
9
|
+
case %s.length
|
10
|
+
when 36 then UUIDTools::UUID.parse(%s)
|
11
|
+
when 32 then UUIDTools::UUID.parse_hexdigest(%s)
|
13
12
|
when 0 then nil
|
14
|
-
else UUIDTools::UUID.parse_raw(
|
13
|
+
else UUIDTools::UUID.parse_raw(%s)
|
15
14
|
end
|
16
15
|
EOS
|
17
16
|
end
|
@@ -2,23 +2,22 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe FastAttributes::UUID do
|
4
4
|
it 'adds UUID type to supported list' do
|
5
|
-
expect(FastAttributes.type_casting).to eq(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
else UUIDTools::UUID.parse_raw(_value)
|
5
|
+
expect(FastAttributes.type_casting[UUIDTools::UUID].template.gsub(/\s*/, '')).to eq(<<-EOS.gsub(/\s*/, '')
|
6
|
+
case %s
|
7
|
+
when nil
|
8
|
+
nil
|
9
|
+
when UUIDTools::UUID
|
10
|
+
%s
|
11
|
+
else
|
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
|
19
18
|
end
|
20
19
|
EOS
|
21
|
-
|
20
|
+
)
|
22
21
|
end
|
23
22
|
|
24
23
|
it 'attribute parses UUID value' do
|
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.
|
4
|
+
version: 0.0.4
|
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-
|
11
|
+
date: 2014-07-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.
|
19
|
+
version: 0.5.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.
|
26
|
+
version: 0.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: uuidtools
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|