has_uuid 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module HasUuid
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/has_uuid.rb CHANGED
@@ -39,6 +39,11 @@ module ActiveRecord #:nodoc:
39
39
  end
40
40
  end
41
41
 
42
+ def generate_uuid
43
+ UUIDTools::UUID.send("#{uuid_generator}_create").to_s
44
+ end
45
+
46
+
42
47
  module InstanceMethods #:nodoc:
43
48
  def assign_uuid(options = {})
44
49
  return if uuid_valid? unless options[:force]
@@ -9,6 +9,11 @@ class Thingy < ActiveRecord::Base
9
9
  end
10
10
 
11
11
  class HasUuidTest < Test::Unit::TestCase
12
+ def test_should_generate_a_valid_uuid
13
+ uuid = Widget.generate_uuid
14
+ assert UUIDTools::UUID.parse(uuid).kind_of?(UUIDTools::UUID)
15
+ end
16
+
12
17
  def test_should_assign_uuid
13
18
  @widget = Widget.new
14
19
  @widget.assign_uuid
metadata CHANGED
@@ -1,80 +1,61 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_uuid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 3
10
- version: 0.0.3
5
+ version: 0.0.4
11
6
  platform: ruby
12
7
  authors:
13
- - !binary |
14
- VGltbyBSw7bDn25lcg==
15
-
8
+ - "Timo R\xC3\xB6\xC3\x9Fner"
16
9
  autorequire:
17
10
  bindir: bin
18
11
  cert_chain: []
19
12
 
20
- date: 2011-08-01 00:00:00 +02:00
13
+ date: 2011-08-05 00:00:00 +02:00
21
14
  default_executable:
22
15
  dependencies:
23
16
  - !ruby/object:Gem::Dependency
24
17
  name: activerecord
25
- prerelease: false
26
18
  requirement: &id001 !ruby/object:Gem::Requirement
27
19
  none: false
28
20
  requirements:
29
21
  - - ">="
30
22
  - !ruby/object:Gem::Version
31
- hash: 3
32
- segments:
33
- - 0
34
23
  version: "0"
35
24
  type: :runtime
25
+ prerelease: false
36
26
  version_requirements: *id001
37
27
  - !ruby/object:Gem::Dependency
38
28
  name: uuidtools
39
- prerelease: false
40
29
  requirement: &id002 !ruby/object:Gem::Requirement
41
30
  none: false
42
31
  requirements:
43
32
  - - ">="
44
33
  - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
34
  version: "0"
49
35
  type: :runtime
36
+ prerelease: false
50
37
  version_requirements: *id002
51
38
  - !ruby/object:Gem::Dependency
52
39
  name: rake
53
- prerelease: false
54
40
  requirement: &id003 !ruby/object:Gem::Requirement
55
41
  none: false
56
42
  requirements:
57
43
  - - ">="
58
44
  - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
45
  version: "0"
63
46
  type: :development
47
+ prerelease: false
64
48
  version_requirements: *id003
65
49
  - !ruby/object:Gem::Dependency
66
50
  name: sqlite3
67
- prerelease: false
68
51
  requirement: &id004 !ruby/object:Gem::Requirement
69
52
  none: false
70
53
  requirements:
71
54
  - - ">="
72
55
  - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
56
  version: "0"
77
57
  type: :development
58
+ prerelease: false
78
59
  version_requirements: *id004
79
60
  description: The has_uuid gem adds a UUID to your AR models. See the README for details.
80
61
  email:
@@ -111,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
92
  requirements:
112
93
  - - ">="
113
94
  - !ruby/object:Gem::Version
114
- hash: 3
95
+ hash: 150701389
115
96
  segments:
116
97
  - 0
117
98
  version: "0"
@@ -120,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
101
  requirements:
121
102
  - - ">="
122
103
  - !ruby/object:Gem::Version
123
- hash: 3
104
+ hash: 150701389
124
105
  segments:
125
106
  - 0
126
107
  version: "0"