degu 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -2
- data/VERSION +1 -1
- data/degu.gemspec +6 -12
- data/lib/degu/has_set.rb +16 -18
- data/lib/degu/version.rb +1 -1
- metadata +61 -122
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/degu.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "degu"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Florian Frank"]
|
9
|
-
s.date = "
|
9
|
+
s.date = "2012-07-05"
|
10
10
|
s.description = "Library that includes enums, and rails support for enums and bitfield sets."
|
11
11
|
s.email = "dev@pkw.de"
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/degu/has_enum.rb", "lib/degu/has_set.rb", "lib/degu/polite.rb", "lib/degu/renum/enumerated_value.rb", "lib/degu/renum/enumerated_value_type_factory.rb", "lib/degu/renum.rb", "lib/degu/rude.rb", "lib/degu/version.rb", "lib/degu.rb"]
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.homepage = "http://github.com/caroo/degu"
|
15
15
|
s.rdoc_options = ["--title", "Degu - Library for enums and bitfield sets.", "--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
|
-
s.rubygems_version = "1.8.
|
17
|
+
s.rubygems_version = "1.8.24"
|
18
18
|
s.summary = "Library for enums and bitfield sets."
|
19
19
|
s.test_files = ["test/has_enum_test.rb", "test/has_set_test.rb"]
|
20
20
|
|
@@ -22,29 +22,23 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.specification_version = 3
|
23
23
|
|
24
24
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
|
-
s.add_development_dependency(%q<gem_hadar>, ["~> 0.1.
|
25
|
+
s.add_development_dependency(%q<gem_hadar>, ["~> 0.1.8"])
|
26
26
|
s.add_development_dependency(%q<mocha>, [">= 0"])
|
27
27
|
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
28
28
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
29
|
-
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
30
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
31
29
|
s.add_runtime_dependency(%q<activerecord>, ["~> 3.0"])
|
32
30
|
else
|
33
|
-
s.add_dependency(%q<gem_hadar>, ["~> 0.1.
|
31
|
+
s.add_dependency(%q<gem_hadar>, ["~> 0.1.8"])
|
34
32
|
s.add_dependency(%q<mocha>, [">= 0"])
|
35
33
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
36
34
|
s.add_dependency(%q<rspec>, [">= 0"])
|
37
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
38
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
39
35
|
s.add_dependency(%q<activerecord>, ["~> 3.0"])
|
40
36
|
end
|
41
37
|
else
|
42
|
-
s.add_dependency(%q<gem_hadar>, ["~> 0.1.
|
38
|
+
s.add_dependency(%q<gem_hadar>, ["~> 0.1.8"])
|
43
39
|
s.add_dependency(%q<mocha>, [">= 0"])
|
44
40
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
45
41
|
s.add_dependency(%q<rspec>, [">= 0"])
|
46
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
47
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
48
42
|
s.add_dependency(%q<activerecord>, ["~> 3.0"])
|
49
43
|
end
|
50
44
|
end
|
data/lib/degu/has_set.rb
CHANGED
@@ -80,26 +80,24 @@ module Degu
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
83
|
+
def has_set_coerce_argument_value(enum_class, argument_value)
|
84
|
+
invalid_set_elements = []
|
85
|
+
set_elements =
|
86
|
+
if String === argument_value
|
87
|
+
argument_value.split(',').map(&:strip)
|
88
|
+
else
|
89
|
+
Array(argument_value)
|
90
|
+
end.map do |set_element|
|
91
|
+
if result = enum_class[set_element]
|
92
|
+
result
|
89
93
|
else
|
90
|
-
|
91
|
-
|
92
|
-
if result = enum_class[set_element]
|
93
|
-
result
|
94
|
-
else
|
95
|
-
invalid_set_elements << set_element
|
96
|
-
nil
|
97
|
-
end
|
94
|
+
invalid_set_elements << set_element
|
95
|
+
nil
|
98
96
|
end
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
97
|
+
end
|
98
|
+
invalid_set_elements.empty? or
|
99
|
+
raise ArgumentError, "element #{argument_value.inspect} contains invalid elements: #{invalid_set_elements.inspect}"
|
100
|
+
set_elements
|
103
101
|
end
|
104
102
|
end
|
105
103
|
end
|
data/lib/degu/version.rb
CHANGED
metadata
CHANGED
@@ -1,130 +1,77 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: degu
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Florian Frank
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-07-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: gem_hadar
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2153068860 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 1
|
32
|
-
- 3
|
33
|
-
version: 0.1.3
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.1.8
|
34
22
|
type: :development
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: mocha
|
38
23
|
prerelease: false
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 3
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
48
|
-
type: :development
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: sqlite3
|
52
|
-
prerelease: false
|
53
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: *2153068860
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: mocha
|
27
|
+
requirement: &2153067800 !ruby/object:Gem::Requirement
|
54
28
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
62
33
|
type: :development
|
63
|
-
version_requirements: *id003
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: rspec
|
66
34
|
prerelease: false
|
67
|
-
|
35
|
+
version_requirements: *2153067800
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: sqlite3
|
38
|
+
requirement: &2153066800 !ruby/object:Gem::Requirement
|
68
39
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
76
44
|
type: :development
|
77
|
-
version_requirements: *id004
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: ruby-debug
|
80
45
|
prerelease: false
|
81
|
-
|
46
|
+
version_requirements: *2153066800
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: &2153065960 !ruby/object:Gem::Requirement
|
82
50
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
90
55
|
type: :development
|
91
|
-
version_requirements: *id005
|
92
|
-
- !ruby/object:Gem::Dependency
|
93
|
-
name: rcov
|
94
56
|
prerelease: false
|
95
|
-
|
96
|
-
|
97
|
-
requirements:
|
98
|
-
- - ">="
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
hash: 3
|
101
|
-
segments:
|
102
|
-
- 0
|
103
|
-
version: "0"
|
104
|
-
type: :development
|
105
|
-
version_requirements: *id006
|
106
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *2153065960
|
58
|
+
- !ruby/object:Gem::Dependency
|
107
59
|
name: activerecord
|
108
|
-
|
109
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
60
|
+
requirement: &2153064900 !ruby/object:Gem::Requirement
|
110
61
|
none: false
|
111
|
-
requirements:
|
62
|
+
requirements:
|
112
63
|
- - ~>
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
segments:
|
116
|
-
- 3
|
117
|
-
- 0
|
118
|
-
version: "3.0"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '3.0'
|
119
66
|
type: :runtime
|
120
|
-
|
121
|
-
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2153064900
|
69
|
+
description: Library that includes enums, and rails support for enums and bitfield
|
70
|
+
sets.
|
122
71
|
email: dev@pkw.de
|
123
72
|
executables: []
|
124
|
-
|
125
73
|
extensions: []
|
126
|
-
|
127
|
-
extra_rdoc_files:
|
74
|
+
extra_rdoc_files:
|
128
75
|
- README.rdoc
|
129
76
|
- lib/degu/has_enum.rb
|
130
77
|
- lib/degu/has_set.rb
|
@@ -135,7 +82,7 @@ extra_rdoc_files:
|
|
135
82
|
- lib/degu/rude.rb
|
136
83
|
- lib/degu/version.rb
|
137
84
|
- lib/degu.rb
|
138
|
-
files:
|
85
|
+
files:
|
139
86
|
- .gitignore
|
140
87
|
- Gemfile
|
141
88
|
- README.rdoc
|
@@ -159,40 +106,32 @@ files:
|
|
159
106
|
- test_helper.rb
|
160
107
|
homepage: http://github.com/caroo/degu
|
161
108
|
licenses: []
|
162
|
-
|
163
109
|
post_install_message:
|
164
|
-
rdoc_options:
|
110
|
+
rdoc_options:
|
165
111
|
- --title
|
166
112
|
- Degu - Library for enums and bitfield sets.
|
167
113
|
- --main
|
168
114
|
- README.rdoc
|
169
|
-
require_paths:
|
115
|
+
require_paths:
|
170
116
|
- lib
|
171
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
172
118
|
none: false
|
173
|
-
requirements:
|
174
|
-
- -
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
|
177
|
-
|
178
|
-
- 0
|
179
|
-
version: "0"
|
180
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
124
|
none: false
|
182
|
-
requirements:
|
183
|
-
- -
|
184
|
-
- !ruby/object:Gem::Version
|
185
|
-
|
186
|
-
segments:
|
187
|
-
- 0
|
188
|
-
version: "0"
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
189
129
|
requirements: []
|
190
|
-
|
191
130
|
rubyforge_project:
|
192
|
-
rubygems_version: 1.8.
|
131
|
+
rubygems_version: 1.8.11
|
193
132
|
signing_key:
|
194
133
|
specification_version: 3
|
195
134
|
summary: Library for enums and bitfield sets.
|
196
|
-
test_files:
|
135
|
+
test_files:
|
197
136
|
- test/has_enum_test.rb
|
198
137
|
- test/has_set_test.rb
|