acts_as_random_id 0.0.2.beta → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+ script: "bundle exec rake"
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - ree
6
+ - rbx
7
+ - rbx-2.0
8
+ notifications:
9
+ recipients:
10
+ - shaliko@ezid.ru
@@ -1,5 +1,7 @@
1
1
  =ActsAsRandomId
2
2
 
3
+ {<img src="https://secure.travis-ci.org/shaliko/acts_as_random_id.png" />}[http://travis-ci.org/shaliko/acts_as_random_id]
4
+
3
5
  Generating unique random id for ActiveRecord models
4
6
 
5
7
  ==Example
@@ -28,9 +30,9 @@ Generating unique random id for ActiveRecord models
28
30
 
29
31
  As you know rails generates field ID easy auto_incriment. Thus, there is an opportunity to check how many objects in the DB. Sometimes it's secret information.
30
32
 
31
- Using the plugin "acts_as_random_id" could generate a unique value id. Generation of ID will be until you will find a unique value ID. Of course you go to the full responsibility for the range.
33
+ Using the plugin "acts_as_random_id" could generate a unique value ID. Generation of ID will be until you will find a unique value ID. Of course you go to the full responsibility for the range.
32
34
 
33
- By default, the plugin "acts_as_random_id" generates a unique id in the range of 1 to 2_147_483_647 (mysql and SQLite type integer)
35
+ By default, the plugin "acts_as_random_id" generates a unique ID in the range of 1 to 2_147_483_647 (mysql and SQLite type integer)
34
36
 
35
37
  class Comment < ActiveRecord::Base
36
38
  acts_as_random_id
@@ -3,6 +3,9 @@ module ActsAsRandomId
3
3
  def self.included(base)
4
4
  base.send :extend, ClassMethods
5
5
 
6
+ # Handles a generate unique ID
7
+ # @param [Hash] options. The default format is "!{:field => :id}".
8
+ # @return [Integer, String] the value of unique ID.
6
9
  def ensure_unique_id(options)
7
10
  begin
8
11
  self.send "#{options[:field]}=", yield
@@ -11,8 +14,11 @@ module ActsAsRandomId
11
14
  end
12
15
 
13
16
  module ClassMethods
14
- # Default options:
15
- # :field => :id
17
+ # Handles a choice of the generator
18
+ # @scope class
19
+ # @param [Hash] options. The default format is "!{:field => :id}".
20
+ # @param [Proc] &block
21
+ # @return [Integer, String] the value of unique ID.
16
22
  def acts_as_random_id(options={:field => :id}, &block)
17
23
  before_create do |record|
18
24
  if block
@@ -1,3 +1,3 @@
1
1
  module ActsAsRandomId
2
- VERSION = "0.0.2.beta"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_random_id
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31098185
5
- prerelease: 6
4
+ hash: 23
5
+ prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
9
  - 0
9
- - 2
10
- - beta
11
- version: 0.0.2.beta
10
+ version: 1.0.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Shaliko Usubov
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2011-12-04 00:00:00 Z
18
+ date: 2011-12-11 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rspec
@@ -74,6 +73,7 @@ extra_rdoc_files: []
74
73
 
75
74
  files:
76
75
  - .gitignore
76
+ - .travis.yml
77
77
  - Gemfile
78
78
  - Gemfile.lock
79
79
  - LICENSE
@@ -107,14 +107,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
110
- - - ">"
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
- hash: 25
112
+ hash: 3
113
113
  segments:
114
- - 1
115
- - 3
116
- - 1
117
- version: 1.3.1
114
+ - 0
115
+ version: "0"
118
116
  requirements: []
119
117
 
120
118
  rubyforge_project: acts_as_random_id
@@ -126,3 +124,4 @@ test_files:
126
124
  - spec/acts_as_random_id/model_additions_spec.rb
127
125
  - spec/acts_as_random_id_spec.rb
128
126
  - spec/spec_helper.rb
127
+ has_rdoc: