has-bit-field 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/Gemfile.lock +19 -6
- data/has-bit-field.gemspec +2 -2
- data/lib/has-bit-field.rb +4 -0
- data/lib/has-bit-field/version.rb +1 -1
- data/test/has-bit-field_test.rb +8 -0
- metadata +48 -63
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm
|
1
|
+
rvm ruby-1.9.3@has-bit-field --create
|
data/Gemfile.lock
CHANGED
@@ -6,15 +6,28 @@ PATH
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
activesupport (= 2.
|
11
|
-
|
12
|
-
|
9
|
+
activemodel (3.2.11)
|
10
|
+
activesupport (= 3.2.11)
|
11
|
+
builder (~> 3.0.0)
|
12
|
+
activerecord (3.2.11)
|
13
|
+
activemodel (= 3.2.11)
|
14
|
+
activesupport (= 3.2.11)
|
15
|
+
arel (~> 3.0.2)
|
16
|
+
tzinfo (~> 0.3.29)
|
17
|
+
activesupport (3.2.11)
|
18
|
+
i18n (~> 0.6)
|
19
|
+
multi_json (~> 1.0)
|
20
|
+
arel (3.0.2)
|
21
|
+
builder (3.0.4)
|
22
|
+
i18n (0.6.1)
|
23
|
+
multi_json (1.5.0)
|
24
|
+
sqlite3 (1.3.7)
|
25
|
+
tzinfo (0.3.35)
|
13
26
|
|
14
27
|
PLATFORMS
|
15
28
|
ruby
|
16
29
|
|
17
30
|
DEPENDENCIES
|
18
|
-
activerecord (~>
|
31
|
+
activerecord (~> 3.0)
|
19
32
|
has-bit-field!
|
20
|
-
sqlite3
|
33
|
+
sqlite3
|
data/has-bit-field.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = "Provides an easy way to work with bit fields in active record"
|
14
14
|
|
15
15
|
s.rubyforge_project = "has-bit-field"
|
16
|
-
s.add_development_dependency "sqlite3
|
17
|
-
s.add_development_dependency "activerecord", "~>
|
16
|
+
s.add_development_dependency "sqlite3"
|
17
|
+
s.add_development_dependency "activerecord", "~> 3.0"
|
18
18
|
|
19
19
|
s.files = `git ls-files`.split("\n")
|
20
20
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/has-bit-field.rb
CHANGED
@@ -4,6 +4,10 @@ module HasBitField
|
|
4
4
|
# all following arguments should also be symbols,
|
5
5
|
# which will be the name of each flag in the bit field
|
6
6
|
def has_bit_field(bit_field_attribute, *args)
|
7
|
+
if columns_hash[bit_field_attribute.to_s].blank?
|
8
|
+
Rails.logger.error("[has_bit_field] column undefined #{bit_field_attribute}") if defined?(Rails) && Rails.respond_to?(:logger)
|
9
|
+
return
|
10
|
+
end
|
7
11
|
args.each_with_index do |field,i|
|
8
12
|
class_eval %{
|
9
13
|
class << self
|
data/test/has-bit-field_test.rb
CHANGED
@@ -206,4 +206,12 @@ class HasBitFieldTest < Test::Unit::TestCase
|
|
206
206
|
assert s.save
|
207
207
|
end
|
208
208
|
|
209
|
+
def test_environment_will_not_die_on_undefined_fields
|
210
|
+
assert_nothing_raised do
|
211
|
+
Person.class_eval do
|
212
|
+
has_bit_field :not_a_happy_field, :if_only_it_existed, :but_its_not_in_the_db, :we_had_hoped_for_it_but_its_not_there, :silence
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
209
217
|
end
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: has-bit-field
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 1.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Paul Barry
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
12
|
+
date: 2013-01-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: sqlite3
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :development
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: activerecord
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: activerecord
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
38
33
|
none: false
|
39
|
-
requirements:
|
34
|
+
requirements:
|
40
35
|
- - ~>
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
segments:
|
44
|
-
- 2
|
45
|
-
- 3
|
46
|
-
- 5
|
47
|
-
version: 2.3.5
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.0'
|
48
38
|
type: :development
|
49
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.0'
|
50
46
|
description: Provides an easy way to work with bit fields in active record
|
51
|
-
email:
|
47
|
+
email:
|
52
48
|
- mail@paulbarry.com
|
53
49
|
executables: []
|
54
|
-
|
55
50
|
extensions: []
|
56
|
-
|
57
51
|
extra_rdoc_files: []
|
58
|
-
|
59
|
-
files:
|
52
|
+
files:
|
60
53
|
- .document
|
61
54
|
- .gitignore
|
62
55
|
- .rvmrc
|
@@ -73,37 +66,29 @@ files:
|
|
73
66
|
- test/test_helper.rb
|
74
67
|
homepage: http://github.com/pjb3/has-bit-field
|
75
68
|
licenses: []
|
76
|
-
|
77
69
|
post_install_message:
|
78
70
|
rdoc_options: []
|
79
|
-
|
80
|
-
require_paths:
|
71
|
+
require_paths:
|
81
72
|
- lib
|
82
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
74
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
|
89
|
-
- 0
|
90
|
-
version: "0"
|
91
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
80
|
none: false
|
93
|
-
requirements:
|
94
|
-
- -
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
|
97
|
-
segments:
|
98
|
-
- 0
|
99
|
-
version: "0"
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
100
85
|
requirements: []
|
101
|
-
|
102
86
|
rubyforge_project: has-bit-field
|
103
|
-
rubygems_version: 1.8.
|
87
|
+
rubygems_version: 1.8.24
|
104
88
|
signing_key:
|
105
89
|
specification_version: 3
|
106
90
|
summary: Provides an easy way to work with bit fields in active record
|
107
|
-
test_files:
|
91
|
+
test_files:
|
108
92
|
- test/has-bit-field_test.rb
|
109
93
|
- test/test_helper.rb
|
94
|
+
has_rdoc:
|