enumerated_field 0.3.0 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -3,7 +3,6 @@ rvm:
3
3
  - 1.9.2
4
4
  - ree
5
5
  - ruby-head
6
- - rbx-2.0
7
6
  notifications:
8
7
  # overriding this so billing@teamsporttech.com (who owns the repo) doesn't get spammed
9
8
  # anyone, feel free to add yourselves
data/CHANGELOG CHANGED
@@ -65,3 +65,14 @@ v0.2.0
65
65
  * tests pass with ruby 1.9
66
66
  * fix test load path for ruby 1.9
67
67
  * changed to use class_eval for the values_array
68
+
69
+ v0.3.0
70
+
71
+ * Bump version number
72
+ * Add changelog
73
+ * Test that FIELDNAME_values returns the values in original symbol form
74
+ * Return original value from the constants
75
+ * Remove JRuby from Travis CI
76
+ * Complete the examples in the README
77
+ * cleaning up whitespace
78
+ * updated README with new scopes
@@ -25,12 +25,13 @@ Gem::Specification.new do |s|
25
25
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
26
  s.require_paths = ["lib"]
27
27
 
28
- s.add_dependency 'activemodel'
29
- s.add_dependency 'activesupport'
28
+ s.add_dependency 'activemodel', '~> 3.0.0'
29
+ s.add_dependency 'activesupport', '~> 3.0.0'
30
+ s.add_development_dependency 'minitest'
30
31
  s.add_development_dependency 'rake'
31
32
  s.add_development_dependency 'bundler'
32
33
  s.add_development_dependency 'turn'
33
- s.add_development_dependency 'shoulda'
34
- s.add_development_dependency 'activerecord'
34
+ s.add_development_dependency 'shoulda', '~> 2'
35
+ s.add_development_dependency 'activerecord', '~> 3.0.0'
35
36
  s.add_development_dependency 'sqlite3'
36
37
  end
@@ -34,6 +34,12 @@ module EnumeratedField
34
34
  values_array
35
35
  end
36
36
  end
37
+
38
+ define_method("#{field_name}_for_json") do
39
+ values_array.map do |value, key|
40
+ {:display => value, :value => key}
41
+ end
42
+ end
37
43
  end
38
44
 
39
45
  class_eval do
@@ -1,3 +1,3 @@
1
1
  module EnumeratedField
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.5"
3
3
  end
@@ -27,6 +27,15 @@ class EnumeratedFieldTest < Test::Unit::TestCase
27
27
  assert_equal "hate-hate", Banana::TASTINESS_HATE_HATE
28
28
  end
29
29
 
30
+ should 'have the color_for_json method' do
31
+ assert_equal Apple.color_for_json.length, 2
32
+ end
33
+
34
+ should 'show Red for first element display and equal red for value' do
35
+ assert_equal Apple.color_for_json[0][:display], 'Red'
36
+ assert_equal Apple.color_for_json[0][:value], :red
37
+ end
38
+
30
39
  end
31
40
 
32
41
  context 'EnumeratedField instance' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumerated_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,33 +11,59 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-10-05 00:00:00.000000000Z
14
+ date: 2012-05-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activemodel
18
- requirement: &2153550040 !ruby/object:Gem::Requirement
18
+ requirement: !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
- - - ! '>='
21
+ - - ~>
22
22
  - !ruby/object:Gem::Version
23
- version: '0'
23
+ version: 3.0.0
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2153550040
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: 3.0.0
27
32
  - !ruby/object:Gem::Dependency
28
33
  name: activesupport
29
- requirement: &2153549260 !ruby/object:Gem::Requirement
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: 3.0.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 3.0.0
48
+ - !ruby/object:Gem::Dependency
49
+ name: minitest
50
+ requirement: !ruby/object:Gem::Requirement
30
51
  none: false
31
52
  requirements:
32
53
  - - ! '>='
33
54
  - !ruby/object:Gem::Version
34
55
  version: '0'
35
- type: :runtime
56
+ type: :development
36
57
  prerelease: false
37
- version_requirements: *2153549260
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
38
64
  - !ruby/object:Gem::Dependency
39
65
  name: rake
40
- requirement: &2153548240 !ruby/object:Gem::Requirement
66
+ requirement: !ruby/object:Gem::Requirement
41
67
  none: false
42
68
  requirements:
43
69
  - - ! '>='
@@ -45,10 +71,15 @@ dependencies:
45
71
  version: '0'
46
72
  type: :development
47
73
  prerelease: false
48
- version_requirements: *2153548240
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
49
80
  - !ruby/object:Gem::Dependency
50
81
  name: bundler
51
- requirement: &2153546240 !ruby/object:Gem::Requirement
82
+ requirement: !ruby/object:Gem::Requirement
52
83
  none: false
53
84
  requirements:
54
85
  - - ! '>='
@@ -56,10 +87,15 @@ dependencies:
56
87
  version: '0'
57
88
  type: :development
58
89
  prerelease: false
59
- version_requirements: *2153546240
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
60
96
  - !ruby/object:Gem::Dependency
61
97
  name: turn
62
- requirement: &2153545020 !ruby/object:Gem::Requirement
98
+ requirement: !ruby/object:Gem::Requirement
63
99
  none: false
64
100
  requirements:
65
101
  - - ! '>='
@@ -67,32 +103,47 @@ dependencies:
67
103
  version: '0'
68
104
  type: :development
69
105
  prerelease: false
70
- version_requirements: *2153545020
71
- - !ruby/object:Gem::Dependency
72
- name: shoulda
73
- requirement: &2153544100 !ruby/object:Gem::Requirement
106
+ version_requirements: !ruby/object:Gem::Requirement
74
107
  none: false
75
108
  requirements:
76
109
  - - ! '>='
77
110
  - !ruby/object:Gem::Version
78
111
  version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: shoulda
114
+ requirement: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ~>
118
+ - !ruby/object:Gem::Version
119
+ version: '2'
79
120
  type: :development
80
121
  prerelease: false
81
- version_requirements: *2153544100
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ~>
126
+ - !ruby/object:Gem::Version
127
+ version: '2'
82
128
  - !ruby/object:Gem::Dependency
83
129
  name: activerecord
84
- requirement: &2153542200 !ruby/object:Gem::Requirement
130
+ requirement: !ruby/object:Gem::Requirement
85
131
  none: false
86
132
  requirements:
87
- - - ! '>='
133
+ - - ~>
88
134
  - !ruby/object:Gem::Version
89
- version: '0'
135
+ version: 3.0.0
90
136
  type: :development
91
137
  prerelease: false
92
- version_requirements: *2153542200
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ~>
142
+ - !ruby/object:Gem::Version
143
+ version: 3.0.0
93
144
  - !ruby/object:Gem::Dependency
94
145
  name: sqlite3
95
- requirement: &2153541380 !ruby/object:Gem::Requirement
146
+ requirement: !ruby/object:Gem::Requirement
96
147
  none: false
97
148
  requirements:
98
149
  - - ! '>='
@@ -100,7 +151,12 @@ dependencies:
100
151
  version: '0'
101
152
  type: :development
102
153
  prerelease: false
103
- version_requirements: *2153541380
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ none: false
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
104
160
  description: EnumeratedField is a library that provides some nice methods when a string
105
161
  column is used like an enumeration, meaning there is a list of allowable values
106
162
  for the string column.
@@ -136,21 +192,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
192
  - - ! '>='
137
193
  - !ruby/object:Gem::Version
138
194
  version: '0'
139
- segments:
140
- - 0
141
- hash: -3545795576421567660
142
195
  required_rubygems_version: !ruby/object:Gem::Requirement
143
196
  none: false
144
197
  requirements:
145
198
  - - ! '>='
146
199
  - !ruby/object:Gem::Version
147
200
  version: '0'
148
- segments:
149
- - 0
150
- hash: -3545795576421567660
151
201
  requirements: []
152
202
  rubyforge_project: enumerated_field
153
- rubygems_version: 1.8.6
203
+ rubygems_version: 1.8.24
154
204
  signing_key:
155
205
  specification_version: 3
156
206
  summary: EnumeratedField is a library that provides some nice methods when a string