attr_enumerator 0.4.0 → 0.4.1
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.
- data/CONTRIBUTORS.txt +2 -0
- data/README.rdoc +2 -0
- data/VERSION +1 -1
- data/attr_enumerator.gemspec +2 -1
- data/lib/attr_enumerator.rb +3 -3
- metadata +4 -3
data/CONTRIBUTORS.txt
ADDED
data/README.rdoc
CHANGED
@@ -96,3 +96,5 @@ An options hash may be passed as the last argument to <tt>attr_enumerator</tt> t
|
|
96
96
|
* Start a feature/bugfix branch
|
97
97
|
* Commit and push until you are happy with your contribution
|
98
98
|
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
99
|
+
* Create a pull request
|
100
|
+
* Let me know if you want to be included in CONTRIBUTORS.txt
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/attr_enumerator.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{attr_enumerator}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
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"]
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".rspec",
|
22
|
+
"CONTRIBUTORS.txt",
|
22
23
|
"Gemfile",
|
23
24
|
"LICENSE.txt",
|
24
25
|
"README.rdoc",
|
data/lib/attr_enumerator.rb
CHANGED
@@ -18,10 +18,10 @@ module AttrEnumerator
|
|
18
18
|
end
|
19
19
|
|
20
20
|
choices.each do |choice|
|
21
|
-
|
21
|
+
formatted_choice = prefix + choice.to_s.underscore.parameterize('_')
|
22
22
|
|
23
|
-
define_method(
|
24
|
-
scope
|
23
|
+
define_method(formatted_choice + '?') { self.send(field) == choice }
|
24
|
+
scope formatted_choice, where(field => choice) if self.respond_to? :scope
|
25
25
|
end
|
26
26
|
|
27
27
|
options[:message] ||= :invalid
|
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:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Baker
|
@@ -149,6 +149,7 @@ extra_rdoc_files:
|
|
149
149
|
files:
|
150
150
|
- .document
|
151
151
|
- .rspec
|
152
|
+
- CONTRIBUTORS.txt
|
152
153
|
- Gemfile
|
153
154
|
- LICENSE.txt
|
154
155
|
- README.rdoc
|