attr_enumerator 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +43 -34
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/attr_enumerator.gemspec +6 -11
- data/lib/attr_enumerator.rb +15 -55
- data/spec/attr_enumerator_spec.rb +17 -58
- data/spec/spec_helper.rb +0 -7
- metadata +43 -46
data/README.rdoc
CHANGED
@@ -1,66 +1,76 @@
|
|
1
1
|
= attr_enumerator
|
2
2
|
|
3
|
-
A
|
3
|
+
A method for restricting an attribute to a set of choices.
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
An invocation of <tt>attr_enumerator</tt> will create:
|
6
|
+
|
7
|
+
* A <b>validation</b> requiring the attribute value to be one of the provided choices
|
8
|
+
* A <b>class constant</b> containing all valid choices
|
7
9
|
* <b>Instance methods</b> for each choice, returning <tt>true</tt> if the attribute is that value and <tt>false</tt> otherwise
|
8
10
|
* <b>Scopes</b> for each choice that retrieve records where the attribute is that value (only applicable when used with <tt>ActiveRecord</tt>)
|
9
11
|
|
10
|
-
|
12
|
+
== Example
|
11
13
|
|
12
14
|
class Car < ActiveRecord::Base
|
13
|
-
attr_enumerator :color, [
|
15
|
+
attr_enumerator :color, ['red', 'blue']
|
14
16
|
end
|
15
17
|
|
16
|
-
|
18
|
+
car = Car.new
|
19
|
+
car.color = 'red'
|
20
|
+
|
21
|
+
car.color_red? # => true
|
22
|
+
car.color_blue? # => false
|
23
|
+
|
24
|
+
Car::COLORS # => ['red', 'blue']
|
25
|
+
|
26
|
+
car.save
|
27
|
+
Car.color_red # => [<#Car>]
|
28
|
+
|
29
|
+
car.color = 'green'
|
30
|
+
car.valid? # => false
|
31
|
+
car.errors # => #<OrderedHash {:color=>["is invalid"]}>
|
32
|
+
|
33
|
+
== With or without ActiveRecord
|
34
|
+
|
35
|
+
The <tt>AttrEnumerator</tt> module is automatically included in <tt>ActiveRecord::Base</tt> and is available for use in all ActiveRecord models.
|
36
|
+
|
37
|
+
To use <tt>attr_enumerator</tt> on a non-ActiveRecord model the class must include <tt>ActiveModel::Validations</tt> and provide an accessor to the attribute.
|
17
38
|
|
18
39
|
class Car
|
19
40
|
include ActiveModel::Validations
|
20
41
|
include AttrEnumerator
|
21
42
|
|
22
43
|
attr_accessor :color
|
23
|
-
attr_enumerator :color, [
|
44
|
+
attr_enumerator :color, ['red', 'blue']
|
24
45
|
end
|
25
46
|
|
26
47
|
== Configuration
|
27
48
|
|
28
|
-
|
49
|
+
An options hash may be passed as the last argument to <tt>attr_enumerator</tt> to configure its behavior. For example:
|
29
50
|
|
30
51
|
class Car < ActiveRecord::Base
|
31
|
-
attr_enumerator :color, [
|
52
|
+
attr_enumerator :color, ['red', 'blue'], :constant => :PAINT_COLORS, :prefix => :colored
|
32
53
|
end
|
33
54
|
|
34
|
-
|
55
|
+
Car::PAINT_COLORS # => ['red', 'blue']
|
35
56
|
|
36
|
-
|
37
|
-
|
38
|
-
|
57
|
+
car = Car.new
|
58
|
+
car.color = 'red'
|
59
|
+
car.colored_red? # => true
|
39
60
|
|
40
61
|
=== Options
|
41
|
-
* <tt>create_constant</tt> (default: <tt>true</tt>)
|
42
|
-
|
43
|
-
When <tt>true</tt>, a class constant containing an array of choices is created using the pluralized, uppercased attribute name. Set to a string or symbol to change the constant name or <tt>false</tt> to not create the constant.
|
44
|
-
|
45
|
-
* <tt>create_methods</tt> (default: <tt>true</tt>)
|
46
|
-
|
47
|
-
When <tt>true</tt>, create a method for each choice that returns <tt>true</tt> if the attribute is that value and <tt>false</tt> otherwise. Use the <tt>prefix</tt> and <tt>suffix</tt> options to customize the method names. Set to <tt>false</tt> to not create methods.
|
48
|
-
|
49
|
-
* <tt>create_scopes</tt> (default: <tt>true</tt>, ignored when not using <tt>ActiveRecord</tt>)
|
50
62
|
|
51
|
-
|
63
|
+
* <tt>constant</tt> (default: pluralized, uppercased attribute name)
|
52
64
|
|
53
|
-
|
65
|
+
Set a custom constant name.
|
54
66
|
|
55
|
-
|
56
|
-
|
57
|
-
* <tt>suffix</tt> (default: <tt>false</tt>)
|
67
|
+
* <tt>prefix</tt> (default: attribute name)
|
58
68
|
|
59
|
-
|
69
|
+
Set a custom prefix for methods and scopes. Set to <tt>false</tt> to disable.
|
60
70
|
|
61
|
-
* <tt>message</tt> (default: <tt>"is invalid"</tt>)
|
71
|
+
* <tt>message</tt> (default: internationalized <tt>"is invalid"</tt>)
|
62
72
|
|
63
|
-
|
73
|
+
Set the validation error message when the attribute is not a valid value. Use <tt>%{value}</tt> to refer to the value of the attribute, e.g. <tt>"%{value} is not a valid choice"</tt>.
|
64
74
|
|
65
75
|
* <tt>allow_nil</tt> (default: <tt>false</tt>)
|
66
76
|
|
@@ -72,11 +82,11 @@ Options that may be passed directly to <tt>attr_enumerator</tt> may also be conf
|
|
72
82
|
|
73
83
|
* <tt>if</tt> (default: unused)
|
74
84
|
|
75
|
-
|
85
|
+
Set a method, proc or string to call to determine if the validation should occur. See <tt>ActiveModel::Validations</tt> for more details.
|
76
86
|
|
77
|
-
* <tt>unless</tt>
|
87
|
+
* <tt>unless</tt> (default: unused)
|
78
88
|
|
79
|
-
|
89
|
+
Set a method, proc or string to call to determine if the validation should <em>not</em> occur.
|
80
90
|
|
81
91
|
== Contributing to attr_enumerator
|
82
92
|
|
@@ -86,4 +96,3 @@ Options that may be passed directly to <tt>attr_enumerator</tt> may also be conf
|
|
86
96
|
* Start a feature/bugfix branch
|
87
97
|
* Commit and push until you are happy with your contribution
|
88
98
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
89
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
data/Rakefile
CHANGED
@@ -15,9 +15,9 @@ Jeweler::Tasks.new do |gem|
|
|
15
15
|
gem.name = "attr_enumerator"
|
16
16
|
gem.homepage = "http://github.com/chrisb87/attr_enumerator"
|
17
17
|
gem.license = "MIT"
|
18
|
-
gem.summary = %Q{
|
19
|
-
gem.description = %Q{
|
20
|
-
gem.email = "baker@
|
18
|
+
gem.summary = %Q{A method for restricting an attribute to a set of choices}
|
19
|
+
gem.description = %Q{A method for restricting an attribute to a set of choices}
|
20
|
+
gem.email = "baker.chris.3@gmail.com"
|
21
21
|
gem.authors = ["Chris Baker"]
|
22
22
|
end
|
23
23
|
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/attr_enumerator.gemspec
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{attr_enumerator}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Chris Baker"]
|
12
|
-
s.date = %q{2011-
|
13
|
-
s.description = %q{
|
14
|
-
s.email = %q{baker@
|
12
|
+
s.date = %q{2011-05-06}
|
13
|
+
s.description = %q{A method for restricting an attribute to a set of choices}
|
14
|
+
s.email = %q{baker.chris.3@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
17
|
"README.rdoc"
|
@@ -33,15 +33,10 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.homepage = %q{http://github.com/chrisb87/attr_enumerator}
|
34
34
|
s.licenses = ["MIT"]
|
35
35
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.
|
37
|
-
s.summary = %q{
|
38
|
-
s.test_files = [
|
39
|
-
"spec/attr_enumerator_spec.rb",
|
40
|
-
"spec/spec_helper.rb"
|
41
|
-
]
|
36
|
+
s.rubygems_version = %q{1.7.2}
|
37
|
+
s.summary = %q{A method for restricting an attribute to a set of choices}
|
42
38
|
|
43
39
|
if s.respond_to? :specification_version then
|
44
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
45
40
|
s.specification_version = 3
|
46
41
|
|
47
42
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
data/lib/attr_enumerator.rb
CHANGED
@@ -5,69 +5,29 @@ module AttrEnumerator
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
module ClassMethods
|
8
|
-
def attr_enumerator(field, choices,
|
9
|
-
|
8
|
+
def attr_enumerator(field, choices, options = {})
|
9
|
+
constant = options.delete(:constant) || field.to_s.pluralize.upcase
|
10
|
+
const_set(constant, choices).freeze
|
10
11
|
|
11
|
-
|
12
|
+
raw_prefix = options.delete(:prefix)
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
prefix = case raw_prefix
|
15
|
+
when false, '' then ''
|
16
|
+
when nil then field.to_s + '_'
|
17
|
+
else raw_prefix.to_s + '_'
|
15
18
|
end
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
define_method(formatted_choice + '?'){ self.send(field) == choice }
|
20
|
-
end
|
20
|
+
choices.each do |choice|
|
21
|
+
formated_choice = prefix + choice.to_s.underscore.parameterize('_')
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
23
|
+
define_method(formated_choice + '?') { self.send(field) == choice }
|
24
|
+
scope formated_choice, where(field => choice) if self.respond_to?(:scope)
|
25
25
|
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class Options
|
30
|
-
include ActiveSupport::Configurable
|
31
|
-
|
32
|
-
config.create_constant = true
|
33
|
-
config.create_methods = true
|
34
|
-
config.create_scopes = true
|
35
|
-
config.prefix = true
|
36
|
-
config.suffix = false
|
37
|
-
config.message = :invalid
|
38
|
-
|
39
|
-
VALIDATION_OPTIONS = [:in, :message, :allow_nil, :allow_blank, :if, :unless].freeze
|
40
26
|
|
41
|
-
|
42
|
-
|
43
|
-
options[:validation_options] = options.slice(*VALIDATION_OPTIONS)
|
44
|
-
options.reject!{|k,v| VALIDATION_OPTIONS.include?(k)}
|
45
|
-
|
46
|
-
options[:create_scopes] &= klass.respond_to?(:scope)
|
47
|
-
|
48
|
-
[:prefix, :suffix].each do |affix|
|
49
|
-
options[affix] = case options[affix]
|
50
|
-
when true then field.to_s
|
51
|
-
when false then nil
|
52
|
-
else options[affix].to_s
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
options[:constant] = case options[:create_constant]
|
57
|
-
when true then field.to_s.pluralize.upcase
|
58
|
-
when false then nil
|
59
|
-
else options[:create_constant].to_s
|
60
|
-
end
|
61
|
-
|
62
|
-
options[:formatted_choices] = choices.map do |choice|
|
63
|
-
formatted_choice = choice.to_s.underscore.parameterize('_')
|
64
|
-
formatted_choice.insert(0, options[:prefix] + '_') unless options[:prefix].blank?
|
65
|
-
formatted_choice << '_' + options[:suffix] unless options[:suffix].blank?
|
66
|
-
[formatted_choice, choice]
|
67
|
-
end
|
68
|
-
end
|
27
|
+
options[:message] ||= :invalid
|
28
|
+
validates field, :inclusion => options.merge(:in => choices)
|
69
29
|
end
|
70
30
|
end
|
71
31
|
end
|
72
32
|
|
73
|
-
|
33
|
+
ActiveSupport.on_load(:active_record) { include AttrEnumerator }
|
@@ -69,7 +69,7 @@ describe "AttrEnumerator" do
|
|
69
69
|
instance.should_not be_valid
|
70
70
|
end
|
71
71
|
|
72
|
-
it "should handle
|
72
|
+
it "should handle symbol enumerations distinctively from strings" do
|
73
73
|
subject.attr_enumerator :choice, [:red, :blue]
|
74
74
|
|
75
75
|
instance.choice = :red
|
@@ -78,6 +78,7 @@ describe "AttrEnumerator" do
|
|
78
78
|
|
79
79
|
instance.choice = 'red'
|
80
80
|
instance.should_not be_valid
|
81
|
+
instance.should_not be_choice_red
|
81
82
|
end
|
82
83
|
end
|
83
84
|
|
@@ -92,25 +93,15 @@ describe "AttrEnumerator" do
|
|
92
93
|
subject::CHOICES.should be_frozen
|
93
94
|
end
|
94
95
|
|
95
|
-
it "should allow for explicitly creating the default constant" do
|
96
|
-
subject.attr_enumerator :choice, ['red', 'blue'], :create_constant => true
|
97
|
-
subject::CHOICES.should == ['red', 'blue']
|
98
|
-
end
|
99
|
-
|
100
96
|
it "should allow for a custom constant name using a symbol" do
|
101
|
-
subject.attr_enumerator :choice, ['red', 'blue'], :
|
97
|
+
subject.attr_enumerator :choice, ['red', 'blue'], :constant => :POSSIBLE_COLORS
|
102
98
|
subject::POSSIBLE_COLORS.should == ['red', 'blue']
|
103
99
|
end
|
104
100
|
|
105
101
|
it "should allow for a custom constant name using a string" do
|
106
|
-
subject.attr_enumerator :choice, ['red', 'blue'], :
|
102
|
+
subject.attr_enumerator :choice, ['red', 'blue'], :constant => 'POSSIBLE_COLORS'
|
107
103
|
subject::POSSIBLE_COLORS.should == ['red', 'blue']
|
108
104
|
end
|
109
|
-
|
110
|
-
it "should allow for not creating a constant" do
|
111
|
-
subject.attr_enumerator :choice, ['red', 'blue'], :create_constant => false
|
112
|
-
subject.constants.should_not include('COLORS')
|
113
|
-
end
|
114
105
|
end
|
115
106
|
|
116
107
|
context "methods" do
|
@@ -135,26 +126,13 @@ describe "AttrEnumerator" do
|
|
135
126
|
:ends_with_dot? => 'ends.with.dot.'
|
136
127
|
}
|
137
128
|
|
138
|
-
subject.attr_enumerator :choice, enumerations.values, :prefix => false
|
129
|
+
subject.attr_enumerator :choice, enumerations.values, :prefix => false
|
139
130
|
|
140
131
|
enumerations.keys.each do |method_name|
|
141
132
|
instance.should respond_to method_name
|
142
133
|
end
|
143
134
|
end
|
144
135
|
|
145
|
-
it "should allow for explicitly creating the default methods" do
|
146
|
-
subject.attr_enumerator :choice, ['red', 'blue'], :create_methods => true
|
147
|
-
instance.choice = 'red'
|
148
|
-
|
149
|
-
instance.should respond_to :choice_red?
|
150
|
-
instance.should be_choice_red
|
151
|
-
end
|
152
|
-
|
153
|
-
it "should allow for not creating methods" do
|
154
|
-
subject.attr_enumerator :choice, ['red', 'blue'], :create_methods => false
|
155
|
-
instance.should_not respond_to :choice_red?
|
156
|
-
end
|
157
|
-
|
158
136
|
it "should allow for a custom prefix" do
|
159
137
|
subject.attr_enumerator :choice, ['red', 'blue'], :prefix => 'colored'
|
160
138
|
instance.choice = 'red'
|
@@ -166,34 +144,15 @@ describe "AttrEnumerator" do
|
|
166
144
|
instance.should_not be_colored_blue
|
167
145
|
end
|
168
146
|
|
169
|
-
it "should allow for explicitly using the default prefix" do
|
170
|
-
subject.attr_enumerator :choice, ['red', 'blue'], :prefix => true
|
171
|
-
instance.should respond_to :choice_red?
|
172
|
-
end
|
173
|
-
|
174
147
|
it "should allow for no prefix" do
|
175
148
|
subject.attr_enumerator :choice, ['red', 'blue'], :prefix => false
|
176
|
-
instance.
|
177
|
-
end
|
178
|
-
|
179
|
-
it "should not have a suffix by default" do
|
180
|
-
subject.attr_enumerator :choice, ['red', 'blue']
|
181
|
-
instance.should respond_to :choice_red?
|
182
|
-
end
|
183
|
-
|
184
|
-
it "should allow for explicitly having no suffix" do
|
185
|
-
subject.attr_enumerator :choice, ['red', 'blue'], :suffix => false
|
186
|
-
instance.should respond_to :choice_red?
|
187
|
-
end
|
149
|
+
instance.choice = 'red'
|
188
150
|
|
189
|
-
|
190
|
-
|
191
|
-
instance.should respond_to :choice_red_choice?
|
192
|
-
end
|
151
|
+
instance.should respond_to :red?
|
152
|
+
instance.should be_red
|
193
153
|
|
194
|
-
|
195
|
-
|
196
|
-
instance.should respond_to :choice_red_custom?
|
154
|
+
instance.should respond_to :blue?
|
155
|
+
instance.should_not be_blue
|
197
156
|
end
|
198
157
|
end
|
199
158
|
end
|
@@ -210,19 +169,19 @@ describe "AttrEnumerator" do
|
|
210
169
|
end
|
211
170
|
|
212
171
|
describe "scopes" do
|
213
|
-
it "should create a scope for each enumeration
|
172
|
+
it "should create a scope for each enumeration" do
|
214
173
|
subject.attr_enumerator :choice, ['red', 'blue']
|
215
174
|
subject.choice_red.should be_a ActiveRecord::Relation
|
216
175
|
end
|
217
176
|
|
218
|
-
it "should
|
219
|
-
subject.attr_enumerator :choice, ['red', 'blue'], :
|
220
|
-
subject.
|
177
|
+
it "should create a scope for each enumeration with custom prefix " do
|
178
|
+
subject.attr_enumerator :choice, ['red', 'blue'], :prefix => 'colored'
|
179
|
+
subject.colored_red.should be_a ActiveRecord::Relation
|
221
180
|
end
|
222
181
|
|
223
|
-
it "should
|
224
|
-
subject.attr_enumerator :choice, ['red', 'blue'], :
|
225
|
-
subject.
|
182
|
+
it "should create a scope for each enumeration without prefix " do
|
183
|
+
subject.attr_enumerator :choice, ['red', 'blue'], :prefix => false
|
184
|
+
subject.red.should be_a ActiveRecord::Relation
|
226
185
|
end
|
227
186
|
end
|
228
187
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,6 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
1
|
require 'active_record'
|
5
2
|
require 'attr_enumerator'
|
6
3
|
|
7
|
-
# Requires supporting files with custom matchers and macros, etc,
|
8
|
-
# in ./support/ and its subdirectories.
|
9
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
-
|
11
4
|
class ActiveRecordModel < ActiveRecord::Base
|
12
5
|
establish_connection(:adapter => 'sqlite3', :database => ':memory:')
|
13
6
|
connection.execute("CREATE TABLE #{table_name} (#{primary_key} integer PRIMARY KEY AUTOINCREMENT)")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attr_enumerator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Baker
|
@@ -15,14 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-05-06 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
type: :runtime
|
23
|
-
|
24
|
-
name: activemodel
|
25
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
23
|
none: false
|
27
24
|
requirements:
|
28
25
|
- - ">="
|
@@ -33,12 +30,12 @@ dependencies:
|
|
33
30
|
- 0
|
34
31
|
- 0
|
35
32
|
version: 3.0.0
|
36
|
-
|
33
|
+
version_requirements: *id001
|
34
|
+
name: activemodel
|
35
|
+
prerelease: false
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
37
|
type: :runtime
|
39
|
-
|
40
|
-
name: activesupport
|
41
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
40
|
requirements:
|
44
41
|
- - ">="
|
@@ -49,12 +46,12 @@ dependencies:
|
|
49
46
|
- 0
|
50
47
|
- 0
|
51
48
|
version: 3.0.0
|
52
|
-
|
49
|
+
version_requirements: *id002
|
50
|
+
name: activesupport
|
51
|
+
prerelease: false
|
53
52
|
- !ruby/object:Gem::Dependency
|
54
53
|
type: :development
|
55
|
-
|
56
|
-
name: activerecord
|
57
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
55
|
none: false
|
59
56
|
requirements:
|
60
57
|
- - ">="
|
@@ -65,12 +62,12 @@ dependencies:
|
|
65
62
|
- 0
|
66
63
|
- 0
|
67
64
|
version: 3.0.0
|
68
|
-
|
65
|
+
version_requirements: *id003
|
66
|
+
name: activerecord
|
67
|
+
prerelease: false
|
69
68
|
- !ruby/object:Gem::Dependency
|
70
69
|
type: :development
|
71
|
-
|
72
|
-
name: jeweler
|
73
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
74
71
|
none: false
|
75
72
|
requirements:
|
76
73
|
- - ">="
|
@@ -79,12 +76,12 @@ dependencies:
|
|
79
76
|
segments:
|
80
77
|
- 0
|
81
78
|
version: "0"
|
82
|
-
|
79
|
+
version_requirements: *id004
|
80
|
+
name: jeweler
|
81
|
+
prerelease: false
|
83
82
|
- !ruby/object:Gem::Dependency
|
84
83
|
type: :development
|
85
|
-
|
86
|
-
name: rspec
|
87
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
88
85
|
none: false
|
89
86
|
requirements:
|
90
87
|
- - ">="
|
@@ -95,12 +92,12 @@ dependencies:
|
|
95
92
|
- 5
|
96
93
|
- 0
|
97
94
|
version: 2.5.0
|
98
|
-
|
95
|
+
version_requirements: *id005
|
96
|
+
name: rspec
|
97
|
+
prerelease: false
|
99
98
|
- !ruby/object:Gem::Dependency
|
100
99
|
type: :development
|
101
|
-
|
102
|
-
name: ruby-debug
|
103
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
100
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
104
101
|
none: false
|
105
102
|
requirements:
|
106
103
|
- - ">="
|
@@ -109,12 +106,12 @@ dependencies:
|
|
109
106
|
segments:
|
110
107
|
- 0
|
111
108
|
version: "0"
|
112
|
-
|
109
|
+
version_requirements: *id006
|
110
|
+
name: ruby-debug
|
111
|
+
prerelease: false
|
113
112
|
- !ruby/object:Gem::Dependency
|
114
113
|
type: :development
|
115
|
-
|
116
|
-
name: sqlite3
|
117
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
114
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
118
115
|
none: false
|
119
116
|
requirements:
|
120
117
|
- - ">="
|
@@ -123,12 +120,12 @@ dependencies:
|
|
123
120
|
segments:
|
124
121
|
- 0
|
125
122
|
version: "0"
|
126
|
-
|
123
|
+
version_requirements: *id007
|
124
|
+
name: sqlite3
|
125
|
+
prerelease: false
|
127
126
|
- !ruby/object:Gem::Dependency
|
128
127
|
type: :development
|
129
|
-
|
130
|
-
name: watchr
|
131
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
128
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
132
129
|
none: false
|
133
130
|
requirements:
|
134
131
|
- - ">="
|
@@ -137,9 +134,11 @@ dependencies:
|
|
137
134
|
segments:
|
138
135
|
- 0
|
139
136
|
version: "0"
|
140
|
-
|
141
|
-
|
142
|
-
|
137
|
+
version_requirements: *id008
|
138
|
+
name: watchr
|
139
|
+
prerelease: false
|
140
|
+
description: A method for restricting an attribute to a set of choices
|
141
|
+
email: baker.chris.3@gmail.com
|
143
142
|
executables: []
|
144
143
|
|
145
144
|
extensions: []
|
@@ -160,7 +159,6 @@ files:
|
|
160
159
|
- spec/attr_enumerator_spec.rb
|
161
160
|
- spec/spec_helper.rb
|
162
161
|
- watchr.rb
|
163
|
-
has_rdoc: true
|
164
162
|
homepage: http://github.com/chrisb87/attr_enumerator
|
165
163
|
licenses:
|
166
164
|
- MIT
|
@@ -190,10 +188,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
188
|
requirements: []
|
191
189
|
|
192
190
|
rubyforge_project:
|
193
|
-
rubygems_version: 1.
|
191
|
+
rubygems_version: 1.7.2
|
194
192
|
signing_key:
|
195
193
|
specification_version: 3
|
196
|
-
summary:
|
197
|
-
test_files:
|
198
|
-
|
199
|
-
- spec/spec_helper.rb
|
194
|
+
summary: A method for restricting an attribute to a set of choices
|
195
|
+
test_files: []
|
196
|
+
|