flag_shih_tzu 0.1.0.pre → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  test/debug.log
2
- test/flag_shih_tzu_plugin.sqlite3.db
3
2
  coverage
4
3
  .idea
5
4
  .idea/*
@@ -7,4 +6,6 @@ coverage
7
6
  *.gem
8
7
  .bundle
9
8
  Gemfile.lock
9
+ gemfiles/*.lock
10
10
  pkg/*
11
+ rdoc/*
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ gemfile:
5
+ - gemfiles/Gemfile.activerecord-2.3.x
6
+ - gemfiles/Gemfile.activerecord-3.0.x
7
+ - gemfiles/Gemfile.activerecord-3.1.x
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in ..gemspec
3
+ # Specify your gem's dependencies in flag_shih_tzu.gemspec
4
4
  gemspec
data/README.rdoc CHANGED
@@ -1,59 +1,76 @@
1
1
  =FlagShihTzu
2
2
 
3
- A rails plugin to store a collection of boolean attributes in a single
4
- ActiveRecord column as a bit field.
3
+ Bit fields for ActiveRecord
4
+
5
+ An extension for {ActiveRecord}[https://rubygems.org/gems/activerecord]
6
+ to store a collection of boolean attributes in a single integer column
7
+ as a bit field.
5
8
 
6
9
  http://github.com/xing/flag_shih_tzu
7
10
 
8
- This plugin lets you use a single integer column in an ActiveRecord model
11
+ This gem lets you use a single integer column in an ActiveRecord model
9
12
  to store a collection of boolean attributes (flags). Each flag can be used
10
13
  almost in the same way you would use any boolean attribute on an
11
14
  ActiveRecord object.
12
15
 
13
16
  The benefits:
14
17
  * No migrations needed for new boolean attributes. This helps a lot
15
- if you have very large db-tables where you want to avoid ALTER TABLE whenever
16
- possible.
18
+ if you have very large db-tables, on which you want to avoid ALTER TABLE
19
+ whenever possible.
17
20
  * Only the one integer column needs to be indexed.
18
21
 
19
22
  Using FlagShihTzu, you can add new boolean attributes whenever you want,
20
23
  without needing any migration. Just add a new flag to the +has_flags+ call.
21
24
 
22
- And just in case you are wondering what "Shih Tzu" means:
25
+ And just in case you are wondering what a "Shih Tzu" is:
23
26
  http://en.wikipedia.org/wiki/Shih_Tzu
24
27
 
25
28
 
29
+ ==Build status
30
+
31
+ {<img src="https://secure.travis-ci.org/xing/flag_shih_tzu.png" />}[http://travis-ci.org/xing/flag_shih_tzu]
32
+
33
+
26
34
  ==Prerequisites
27
35
 
28
- FlagShihTzu assumes that your ActiveRecord model already has an integer field
29
- to store the flags, which should be defined to not allow NULL values and
30
- should have a default value of 0 (which means all flags are initially set to
31
- false).
36
+ The gem is actively being tested with:
32
37
 
33
- The plugin has been tested with Rails versions from 2.1 to 3.0 and MySQL,
34
- PostgreSQL and SQLite3 databases. It has been tested with ruby 1.9.2 (with
35
- Rails 3 only).
38
+ * ActiveRecord versions 2.3.x, 3.0.x, 3.1.x
39
+ * MySQL, PostgreSQL and SQLite3 databases
40
+ * Ruby 1.8.7 and 1.9.2
36
41
 
37
42
 
38
43
  ==Installation
39
44
 
40
- ===As plugin (Rails 2.x, Rails 3)
45
+ ===Rails 2.x
46
+
47
+ In environment.rb:
48
+
49
+ config.gem 'flag_shih_tzu'
50
+
51
+ Then:
41
52
 
42
- cd path/to/your/rails-project
43
- ./script/plugin install git://github.com/xing/flag_shih_tzu.git
53
+ $ rake gems:install # use sudo if necessary
44
54
 
45
- ===As gem (Rails 3)
55
+ ===Rails 3
46
56
 
47
- Add following line to your Gemfile:
57
+ In Gemfile:
48
58
 
49
- gem 'flag_shih_tzu', '0.1.0.pre'
59
+ gem 'flag_shih_tzu'
50
60
 
51
- Make sure to install gem with bundler:
61
+ Then:
62
+
63
+ $ bundle install
52
64
 
53
- bundle install
54
65
 
55
66
  ==Usage
56
67
 
68
+ FlagShihTzu assumes that your ActiveRecord model already has an integer field
69
+ to store the flags, which should be defined to not allow NULL values and
70
+ should have a default value of 0 (which means all flags are initially set to
71
+ false).
72
+
73
+
57
74
  ===Defining the flags
58
75
 
59
76
  class Spaceship < ActiveRecord::Base
@@ -71,6 +88,44 @@ That is why the plugin forces you to set them explicitly.
71
88
  The values are symbols for the flags being created.
72
89
 
73
90
 
91
+ ===How it stores the values
92
+
93
+ As said, FlagShihTzu uses a single integer column to store the values for all
94
+ the defined flags as a bit field.
95
+
96
+ The bit position of a flag corresponds to the given key.
97
+
98
+ This way, we can use bit operators on the stored integer value to set, unset
99
+ and check individual flags.
100
+
101
+ +---+---+---+ +---+---+---+
102
+ | | | | | | | |
103
+ Bit position | 3 | 2 | 1 | | 3 | 2 | 1 |
104
+ (flag key) | | | | | | | |
105
+ +---+---+---+ +---+---+---+
106
+ | | | | | | | |
107
+ Bit value | 4 | 2 | 1 | | 4 | 2 | 1 |
108
+ | | | | | | | |
109
+ +---+---+---+ +---+---+---+
110
+ | e | s | w | | e | s | w |
111
+ | l | h | a | | l | h | a |
112
+ | e | i | r | | e | i | r |
113
+ | c | e | p | | c | e | p |
114
+ | t | l | d | | t | l | d |
115
+ | r | d | r | | r | d | r |
116
+ | o | s | i | | o | s | i |
117
+ | l | | v | | l | | v |
118
+ | y | | e | | y | | e |
119
+ | t | | | | t | | |
120
+ | e | | | | e | | |
121
+ | s | | | | s | | |
122
+ +---+---+---+ +---+---+---+
123
+ | 1 | 1 | 0 | = 4 + 2 = 6 | 1 | 0 | 1 | = 4 + 1 = 5
124
+ +---+---+---+ +---+---+---+
125
+
126
+ Read more about bit fields here: http://en.wikipedia.org/wiki/Bit_field
127
+
128
+
74
129
  ===Using a custom column name
75
130
 
76
131
  The default column name to store the flags is 'flags', but you can provide a
@@ -82,7 +137,7 @@ different columns for separate flags:
82
137
  3 => :electrolytes,
83
138
  :column => 'features'
84
139
 
85
- has_flags 1 => :spock,
140
+ has_flags 1 => :spock,
86
141
  2 => :scott,
87
142
  3 => :kirk,
88
143
  :column => 'crew'
@@ -96,12 +151,17 @@ on Spaceship:
96
151
  Spaceship#warpdrive
97
152
  Spaceship#warpdrive?
98
153
  Spaceship#warpdrive=
154
+ Spaceship#warpdrive_changed?
155
+
99
156
  Spaceship#shields
100
157
  Spaceship#shields?
101
158
  Spaceship#shields=
159
+ Spaceship#shields_changed?
160
+
102
161
  Spaceship#electrolytes
103
162
  Spaceship#electrolytes?
104
163
  Spaceship#electrolytes=
164
+ Spaceship#electrolytes_changed?
105
165
 
106
166
 
107
167
  ===Generated named scopes
@@ -141,44 +201,6 @@ the scopes. The option on has_flags is still named <tt>:named_scopes</tt> howeve
141
201
  ...
142
202
 
143
203
 
144
- ===How it stores the values
145
-
146
- As said, FlagShihTzu uses a single integer column to store the values for all
147
- the defined flags as a bit field.
148
-
149
- The bit position of a flag corresponds to the given key.
150
-
151
- This way, we can use bit operators on the stored integer value to set, unset
152
- and check individual flags.
153
-
154
- +---+---+---+ +---+---+---+
155
- | | | | | | | |
156
- Bit position | 3 | 2 | 1 | | 3 | 2 | 1 |
157
- (flag key) | | | | | | | |
158
- +---+---+---+ +---+---+---+
159
- | | | | | | | |
160
- Bit value | 4 | 2 | 1 | | 4 | 2 | 1 |
161
- | | | | | | | |
162
- +---+---+---+ +---+---+---+
163
- | e | s | w | | e | s | w |
164
- | l | h | a | | l | h | a |
165
- | e | i | r | | e | i | r |
166
- | c | e | p | | c | e | p |
167
- | t | l | d | | t | l | d |
168
- | r | d | r | | r | d | r |
169
- | o | s | i | | o | s | i |
170
- | l | | v | | l | | v |
171
- | y | | e | | y | | e |
172
- | t | | | | t | | |
173
- | e | | | | e | | |
174
- | s | | | | s | | |
175
- +---+---+---+ +---+---+---+
176
- | 1 | 1 | 0 | = 4 + 2 = 6 | 1 | 0 | 1 | = 4 + 1 = 5
177
- +---+---+---+ +---+---+---+
178
-
179
- Read more about bit fields here: http://en.wikipedia.org/wiki/Bit_field
180
-
181
-
182
204
  ===Support for manually building conditions
183
205
 
184
206
  The following class methods may support you when manually building
@@ -190,8 +212,8 @@ ActiveRecord conditions:
190
212
  Spaceship.not_shields_condition # "(spaceships.flags not in (2,3,6,7))"
191
213
  Spaceship.electrolytes_condition # "(spaceships.flags in (4,5,6,7))"
192
214
  Spaceship.not_electrolytes_condition # "(spaceships.flags not in (4,5,6,7))"
193
-
194
- These methods also accept a :table_alias option that can be used when
215
+
216
+ These methods also accept a :table_alias option that can be used when
195
217
  generating SQL that references the same table more than once:
196
218
 
197
219
  Spaceship.shields_condition(:table_alias => 'evil_spaceships') # "(evil_spaceships.flags in (2,3,6,7))"
@@ -209,74 +231,75 @@ For MySQL, depending on your MySQL settings, this can even hit the
209
231
  In this case, consider changing the flag query mode to <tt>:bit_operator</tt>
210
232
  instead of <tt>:in_list</tt>, like so:
211
233
 
212
- has_flags 1 => :warpdrive,
213
- 2 => :shields,
234
+ has_flags 1 => :warpdrive,
235
+ 2 => :shields,
214
236
  :flag_query_mode => :bit_operator
215
237
 
216
238
  This will modify the generated condition and named_scope methods to use bit
217
239
  operators in the SQL instead of an IN() list:
218
240
 
219
- Spaceship.warpdrive_condition # "(spaceships.flags & 1 = 1)",
220
- Spaceship.not_warpdrive_condition # "(spaceships.flags & 1 = 0)",
221
- Spaceship.shields_condition # "(spaceships.flags & 2 = 2)",
222
- Spaceship.not_shields_condition # "(spaceships.flags & 2 = 0)",
241
+ Spaceship.warpdrive_condition # "(spaceships.flags & 1 = 1)",
242
+ Spaceship.not_warpdrive_condition # "(spaceships.flags & 1 = 0)",
243
+ Spaceship.shields_condition # "(spaceships.flags & 2 = 2)",
244
+ Spaceship.not_shields_condition # "(spaceships.flags & 2 = 0)",
223
245
 
224
- Spaceship.warpdrive # :conditions => "(spaceships.flags & 1 = 1)"
225
- Spaceship.not_warpdrive # :conditions => "(spaceships.flags & 1 = 0)"
226
- Spaceship.shields # :conditions => "(spaceships.flags & 2 = 2)"
227
- Spaceship.not_shields # :conditions => "(spaceships.flags & 2 = 0)"
246
+ Spaceship.warpdrive # :conditions => "(spaceships.flags & 1 = 1)"
247
+ Spaceship.not_warpdrive # :conditions => "(spaceships.flags & 1 = 0)"
248
+ Spaceship.shields # :conditions => "(spaceships.flags & 2 = 2)"
249
+ Spaceship.not_shields # :conditions => "(spaceships.flags & 2 = 0)"
228
250
 
229
251
  The drawback is that due to the bit operator, this query can not use an index
230
252
  on the flags column.
231
253
 
232
254
 
233
- ==Running the plugin tests
255
+ ==Running the gem tests
256
+
257
+ First, make sure all required gems are installed:
258
+
259
+ $ bundle install
234
260
 
235
- 1. (Rails 3 only) Add <tt>mysql2</tt>, <tt>pg</tt> and <tt>sqlite3</tt> gems to your Gemfile.
236
- 1. Install flag_shih_tzu as plugin inside working Rails application.
237
- 1. Modify <tt>test/database.yml</tt> to fit your test environment.
238
- 2. If needed, create the test database you configured in <tt>test/database.yml</tt>.
261
+ The default rake test task will run the tests against the currently locked
262
+ ActiveRecord version (see +Gemfile.lock+):
239
263
 
240
- Then you can run
264
+ $ bundle exec rake test
241
265
 
242
- DB=mysql|postgres|sqlite3 rake test:plugins PLUGIN=flag_shih_tzu
266
+ If you want to run the tests against all supported ActiveRecord versions:
243
267
 
244
- from your Rails project root or
268
+ $ bundle exec rake test:all
245
269
 
246
- DB=mysql|postgres|sqlite3 rake
270
+ This will internally use bundler to load specific ActiveRecord versions
271
+ before executing the tests (see +gemfiles/+), e.g.:
247
272
 
248
- from <tt>vendor/plugins/flag_shih_tzu</tt>.
273
+ $ BUNDLE_GEMFILE='gemfiles/Gemfile.activerecord-3.1.x' bundle exec rake test
274
+
275
+
276
+ All tests will use an in-memory sqlite database by default.
277
+ If you want to use a different database, see <tt>test/database.yml</tt>,
278
+ install the required adapter gem and use the DB environment variable to
279
+ specify which config from <tt>test/database.yml</tt> to use, e.g.:
280
+
281
+ $ DB=mysql bundle exec rake
249
282
 
250
283
 
251
284
  ==Authors
252
285
 
253
286
  {Patryk Peszko}[http://github.com/ppeszko],
254
287
  {Sebastian Roebke}[http://github.com/boosty],
255
- {David Anderson}[http://github.com/alpinegizmo]
256
- and {Tim Payton}[http://github.com/dizzy42]
288
+ {David Anderson}[http://github.com/alpinegizmo],
289
+ {Tim Payton}[http://github.com/dizzy42]
290
+ and a helpful group of
291
+ {contributors}[https://github.com/xing/flag_shih_tzu/contributors].
292
+ Thanks!
257
293
 
258
294
  Please find out more about our work in our
259
295
  {tech blog}[http://blog.xing.com/category/english/tech-blog].
260
296
 
261
297
 
262
- ==Contributors
263
-
264
- {TobiTobes}[http://github.com/rngtng],
265
- {Martin Stannard}[http://github.com/martinstannard],
266
- {Ladislav Martincik}[http://github.com/lacomartincik],
267
- {Peter Boling}[http://github.com/pboling],
268
- {Daniel Jagszent}[http://github.com/d--j],
269
- {Thorsten Boettger}[http://github.com/alto],
270
- {Darren Torpey}[http://github.com/darrentorpey],
271
- {Joost Baaij}[http://github.com/tilsammans] and
272
- {Musy Bite}[http://github.com/musybite]
273
-
274
-
275
298
  ==License
276
299
 
277
300
  The MIT License
278
301
 
279
- Copyright (c) 2009 {XING AG}[http://www.xing.com/]
302
+ Copyright (c) 2011 {XING AG}[http://www.xing.com/]
280
303
 
281
304
  Permission is hereby granted, free of charge, to any person obtaining a copy
282
305
  of this software and associated documentation files (the "Software"), to deal
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
3
+ require 'rdoc/task'
4
4
 
5
5
  require 'bundler'
6
6
  Bundler::GemHelper.install_tasks
@@ -16,15 +16,23 @@ Rake::TestTask.new(:test) do |t|
16
16
  end
17
17
 
18
18
  desc 'Generate documentation for the flag_shih_tzu plugin.'
19
- Rake::RDocTask.new(:rdoc) do |rdoc|
19
+ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_dir = 'rdoc'
21
21
  rdoc.title = 'FlagShihTzu'
22
- rdoc.options << '--line-numbers' << '--inline-source'
22
+ rdoc.options << '--line-numbers'
23
23
  rdoc.rdoc_files.include('README.rdoc')
24
24
  rdoc.rdoc_files.include('lib/**/*.rb')
25
25
  end
26
26
 
27
27
  namespace :test do
28
+ desc 'Test against all supported ActiveRecord versions'
29
+ task :all do
30
+ %w(2.3.x 3.0.x 3.1.x).each do |version|
31
+ sh "BUNDLE_GEMFILE='gemfiles/Gemfile.activerecord-#{version}' bundle"
32
+ sh "BUNDLE_GEMFILE='gemfiles/Gemfile.activerecord-#{version}' bundle exec rake test"
33
+ end
34
+ end
35
+
28
36
  desc 'Measures test coverage'
29
37
  task :coverage do
30
38
  rm_f "coverage"
@@ -8,9 +8,10 @@ Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Patryk Peszko", "Sebastian Roebke", "David Anderson", "Tim Payton"]
10
10
  s.homepage = "https://github.com/xing/flag_shih_tzu"
11
- s.summary = %q{A rails plugin to store a collection of boolean attributes in a single ActiveRecord column as a bit field}
11
+ s.summary = %q{Bit fields for ActiveRecord}
12
12
  s.description = <<-EODOC
13
- This plugin lets you use a single integer column in an ActiveRecord model
13
+ Bit fields for ActiveRecord:
14
+ This gem lets you use a single integer column in an ActiveRecord model
14
15
  to store a collection of boolean attributes (flags). Each flag can be used
15
16
  almost in the same way you would use any boolean attribute on an
16
17
  ActiveRecord object.
@@ -20,4 +21,12 @@ ActiveRecord object.
20
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
22
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
23
  s.require_paths = ["lib"]
24
+
25
+ s.add_dependency "activerecord", ">= 2.3.0"
26
+
27
+ s.add_development_dependency "bundler"
28
+ s.add_development_dependency "rdoc", ">= 2.4.2"
29
+ s.add_development_dependency "rake"
30
+ s.add_development_dependency "rcov"
31
+ s.add_development_dependency "sqlite3"
23
32
  end
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec :path => '..'
4
+
5
+ gem "activerecord", "~>2.3.0"
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec :path => '..'
4
+
5
+ gem "activerecord", "~>3.0.0"
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec :path => '..'
4
+
5
+ gem "activerecord", "~>3.1.0"
data/lib/flag_shih_tzu.rb CHANGED
@@ -1,9 +1,17 @@
1
+ require "rubygems"
2
+ require "active_record"
3
+ require "active_support/all"
4
+
1
5
  module FlagShihTzu
2
- TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'] # taken from ActiveRecord::ConnectionAdapters::Column
6
+ # taken from ActiveRecord::ConnectionAdapters::Column
7
+ TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE']
8
+
3
9
  DEFAULT_COLUMN_NAME = 'flags'
4
10
 
5
11
  def self.included(base)
6
12
  base.extend(ClassMethods)
13
+ base.class_attribute :flag_options
14
+ base.class_attribute :flag_mapping
7
15
  end
8
16
 
9
17
  class IncorrectFlagColumnException < Exception; end
@@ -18,19 +26,17 @@ module FlagShihTzu
18
26
  :column => DEFAULT_COLUMN_NAME,
19
27
  :flag_query_mode => :in_list
20
28
  }.update(opts)
21
- colmn = opts[:column]
29
+ colmn = opts[:column].to_s
22
30
 
23
31
  return unless check_flag_column(colmn)
24
32
 
25
33
  # options are stored in a class level hash and apply per-column
26
- class_inheritable_hash :flag_options
27
- write_inheritable_attribute(:flag_options, {}) if flag_options.nil?
28
- flag_options[colmn] = opts
34
+ self.flag_options ||= {}
35
+ self.flag_options[colmn] = opts
29
36
 
30
37
  # the mappings are stored in this class level hash and apply per-column
31
- class_inheritable_hash :flag_mapping
32
- write_inheritable_attribute(:flag_mapping, {}) if flag_mapping.nil?
33
- flag_mapping[colmn] ||= {}
38
+ self.flag_mapping ||= {}
39
+ self.flag_mapping[colmn] ||= {}
34
40
 
35
41
  flag_hash.each do |flag_key, flag_name|
36
42
  raise ArgumentError, "has_flags: flag keys should be positive integers, and #{flag_key} is not" unless is_valid_flag_key(flag_key)
@@ -53,6 +59,15 @@ module FlagShihTzu
53
59
  FlagShihTzu::TRUE_VALUES.include?(value) ? enable_flag(:#{flag_name}, '#{colmn}') : disable_flag(:#{flag_name}, '#{colmn}')
54
60
  end
55
61
 
62
+ def #{flag_name}_changed?
63
+ if colmn_changes = changes['#{colmn}']
64
+ flag_bit = self.class.flag_mapping['#{colmn}'][:#{flag_name}]
65
+ (colmn_changes[0] & flag_bit) != (colmn_changes[1] & flag_bit)
66
+ else
67
+ false
68
+ end
69
+ end
70
+
56
71
  def self.#{flag_name}_condition(options = {})
57
72
  sql_condition_for_flag(:#{flag_name}, '#{colmn}', true, options[:table_alias] || self.table_name)
58
73
  end
@@ -98,7 +113,7 @@ module FlagShihTzu
98
113
  # If you are using ActiveRecord then you only want to check for the table if the table exists so it won't fail pre-migration
99
114
  has_ar = !!defined?(ActiveRecord) && self.respond_to?(:descends_from_active_record?)
100
115
  # Supposedly Rails 2.3 takes care of this, but this precaution is needed for backwards compatibility
101
- has_table = has_ar ? ActiveRecord::Base.connection.tables.include?(table_name) : true
116
+ has_table = has_ar ? connection.tables.include?(table_name) : true
102
117
 
103
118
  logger.warn("Error: Table '#{table_name}' doesn't exist") and return false unless has_table
104
119
 
@@ -207,4 +222,3 @@ module FlagShihTzu
207
222
  end
208
223
 
209
224
  end
210
-
@@ -1,3 +1,3 @@
1
1
  module FlagShihTzu
2
- VERSION = "0.1.0.pre"
2
+ VERSION = "0.2.3"
3
3
  end
data/test/database.yml CHANGED
@@ -1,17 +1,13 @@
1
- sqlite3:
1
+ sqlite:
2
2
  adapter: sqlite3
3
- database: test/flag_shih_tzu_plugin.sqlite3.db
4
-
3
+ database: ":memory:"
4
+ timeout: 500
5
5
  mysql:
6
6
  adapter: mysql2
7
- host: localhost
8
- username: root
9
- password:
10
- database: flag_shih_tzu_plugin_test
11
-
7
+ database: flag_shih_tzu_test
8
+ username:
9
+ encoding: utf8
12
10
  postgresql:
13
11
  adapter: postgresql
12
+ database: flag_shih_tzu_test
14
13
  username: postgres
15
- password:
16
- database: flag_shih_tzu_plugin_test
17
- min_messages: ERROR
@@ -1,12 +1,11 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
2
- load_schema
3
2
 
4
3
  class Spaceship < ActiveRecord::Base
5
4
  set_table_name 'spaceships'
6
5
  include FlagShihTzu
7
6
 
8
- has_flags 1 => :warpdrive,
9
- 2 => :shields,
7
+ has_flags 1 => :warpdrive,
8
+ 2 => :shields,
10
9
  3 => :electrolytes
11
10
  end
12
11
 
@@ -31,6 +30,13 @@ class SpaceshipWithCustomFlagsColumn < ActiveRecord::Base
31
30
  has_flags(1 => :warpdrive, 2 => :hyperspace, :column => 'bits')
32
31
  end
33
32
 
33
+ class SpaceshipWithColumnNameAsSymol < ActiveRecord::Base
34
+ set_table_name 'spaceships_with_custom_flags_column'
35
+ include FlagShihTzu
36
+
37
+ has_flags(1 => :warpdrive, 2 => :hyperspace, :column => :bits)
38
+ end
39
+
34
40
  class SpaceshipWith2CustomFlagsColumn < ActiveRecord::Base
35
41
  set_table_name 'spaceships_with_2_custom_flags_column'
36
42
  include FlagShihTzu
@@ -42,7 +48,7 @@ end
42
48
  class SpaceshipWithBitOperatorQueryMode < ActiveRecord::Base
43
49
  set_table_name 'spaceships'
44
50
  include FlagShihTzu
45
-
51
+
46
52
  has_flags(1 => :warpdrive, 2 => :shields, :flag_query_mode => :bit_operator)
47
53
  end
48
54
 
@@ -54,7 +60,7 @@ class Planet < ActiveRecord::Base
54
60
  end
55
61
 
56
62
  class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
57
-
63
+
58
64
  def setup
59
65
  Spaceship.destroy_all
60
66
  end
@@ -87,14 +93,14 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
87
93
  )
88
94
  end
89
95
  end
90
-
96
+
91
97
  def test_has_flags_should_raise_an_exception_when_desired_flag_name_method_already_defined
92
98
  assert_raises ArgumentError do
93
99
  eval(<<-EOF
94
100
  class SpaceshipWithAlreadyUsedMethod < ActiveRecord::Base
95
101
  set_table_name 'spaceships_with_2_custom_flags_column'
96
102
  include FlagShihTzu
97
-
103
+
98
104
  def jeanluckpicard; end
99
105
 
100
106
  has_flags({ 1 => :jeanluckpicard }, :column => 'bits')
@@ -110,7 +116,7 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
110
116
  class SpaceshipWithAlreadyUsedMethodByFlagshitzu < ActiveRecord::Base
111
117
  set_table_name 'spaceships_with_2_custom_flags_column'
112
118
  include FlagShihTzu
113
-
119
+
114
120
  has_flags({ 1 => :jeanluckpicard }, :column => 'bits')
115
121
  has_flags({ 1 => :jeanluckpicard }, :column => 'bits')
116
122
  end
@@ -138,7 +144,7 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
138
144
  assert_equal "(spaceships.flags in (2,3,6,7))", Spaceship.shields_condition
139
145
  assert_equal "(spaceships.flags in (4,5,6,7))", Spaceship.electrolytes_condition
140
146
  end
141
-
147
+
142
148
  def test_should_accept_a_table_alias_option_for_sql_condition_method
143
149
  assert_equal "(old_spaceships.flags in (1,3,5,7))", Spaceship.warpdrive_condition(:table_alias => 'old_spaceships')
144
150
  end
@@ -155,10 +161,10 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
155
161
  assert_equal "(spaceships.flags not in (2,3,6,7))", Spaceship.not_shields_condition
156
162
  assert_equal "(spaceships.flags not in (4,5,6,7))", Spaceship.not_electrolytes_condition
157
163
  end
158
-
164
+
159
165
  def test_should_define_a_sql_condition_method_for_flag_enabled_with_custom_table_name
160
- assert_equal "(custom_spaceships.flags in (1,3,5,7))", Spaceship.send( :sql_condition_for_flag, :warpdrive, 'flags', true, 'custom_spaceships')
161
- end
166
+ assert_equal "(custom_spaceships.flags in (1,3,5,7))", Spaceship.send(:sql_condition_for_flag, :warpdrive, 'flags', true, 'custom_spaceships')
167
+ end
162
168
 
163
169
  def test_should_define_a_sql_condition_method_for_flag_enabled_with_2_colmns_not_enabled
164
170
  assert_equal "(spaceships_with_2_custom_flags_column.bits not in (1,3))", SpaceshipWith2CustomFlagsColumn.not_warpdrive_condition
@@ -166,7 +172,7 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
166
172
  assert_equal "(spaceships_with_2_custom_flags_column.commanders not in (1,3))", SpaceshipWith2CustomFlagsColumn.not_jeanlucpicard_condition
167
173
  assert_equal "(spaceships_with_2_custom_flags_column.commanders not in (2,3))", SpaceshipWith2CustomFlagsColumn.not_dajanatroj_condition
168
174
  end
169
-
175
+
170
176
  def test_should_define_a_sql_condition_method_for_flag_enabled_using_bit_operators
171
177
  assert_equal "(spaceships.flags & 1 = 1)", SpaceshipWithBitOperatorQueryMode.warpdrive_condition
172
178
  assert_equal "(spaceships.flags & 2 = 2)", SpaceshipWithBitOperatorQueryMode.shields_condition
@@ -178,39 +184,39 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
178
184
  end
179
185
 
180
186
  def test_should_define_a_named_scope_for_flag_enabled
181
- assert_equal(["(spaceships.flags in (1,3,5,7))"], Spaceship.warpdrive.where_values)
182
- assert_equal(["(spaceships.flags in (2,3,6,7))"], Spaceship.shields.where_values)
183
- assert_equal(["(spaceships.flags in (4,5,6,7))"], Spaceship.electrolytes.where_values)
187
+ assert_where_value "(spaceships.flags in (1,3,5,7))", Spaceship.warpdrive
188
+ assert_where_value "(spaceships.flags in (2,3,6,7))", Spaceship.shields
189
+ assert_where_value "(spaceships.flags in (4,5,6,7))", Spaceship.electrolytes
184
190
  end
185
191
 
186
192
  def test_should_define_a_named_scope_for_flag_not_enabled
187
- assert_equal(["(spaceships.flags not in (1,3,5,7))"], Spaceship.not_warpdrive.where_values)
188
- assert_equal(["(spaceships.flags not in (2,3,6,7))"], Spaceship.not_shields.where_values)
189
- assert_equal(["(spaceships.flags not in (4,5,6,7))"], Spaceship.not_electrolytes.where_values)
193
+ assert_where_value "(spaceships.flags not in (1,3,5,7))", Spaceship.not_warpdrive
194
+ assert_where_value "(spaceships.flags not in (2,3,6,7))", Spaceship.not_shields
195
+ assert_where_value "(spaceships.flags not in (4,5,6,7))", Spaceship.not_electrolytes
190
196
  end
191
197
 
192
198
  def test_should_define_a_named_scope_for_flag_enabled_with_2_columns
193
- assert_equal(["(spaceships_with_2_custom_flags_column.bits in (1,3))"], SpaceshipWith2CustomFlagsColumn.warpdrive.where_values)
194
- assert_equal(["(spaceships_with_2_custom_flags_column.bits in (2,3))"], SpaceshipWith2CustomFlagsColumn.hyperspace.where_values)
195
- assert_equal(["(spaceships_with_2_custom_flags_column.commanders in (1,3))"], SpaceshipWith2CustomFlagsColumn.jeanlucpicard.where_values)
196
- assert_equal(["(spaceships_with_2_custom_flags_column.commanders in (2,3))"], SpaceshipWith2CustomFlagsColumn.dajanatroj.where_values)
199
+ assert_where_value "(spaceships_with_2_custom_flags_column.bits in (1,3))", SpaceshipWith2CustomFlagsColumn.warpdrive
200
+ assert_where_value "(spaceships_with_2_custom_flags_column.bits in (2,3))", SpaceshipWith2CustomFlagsColumn.hyperspace
201
+ assert_where_value "(spaceships_with_2_custom_flags_column.commanders in (1,3))", SpaceshipWith2CustomFlagsColumn.jeanlucpicard
202
+ assert_where_value "(spaceships_with_2_custom_flags_column.commanders in (2,3))", SpaceshipWith2CustomFlagsColumn.dajanatroj
197
203
  end
198
204
 
199
205
  def test_should_define_a_named_scope_for_flag_not_enabled_with_2_columns
200
- assert_equal(["(spaceships_with_2_custom_flags_column.bits not in (1,3))"], SpaceshipWith2CustomFlagsColumn.not_warpdrive.where_values)
201
- assert_equal(["(spaceships_with_2_custom_flags_column.bits not in (2,3))"], SpaceshipWith2CustomFlagsColumn.not_hyperspace.where_values)
202
- assert_equal(["(spaceships_with_2_custom_flags_column.commanders not in (1,3))"], SpaceshipWith2CustomFlagsColumn.not_jeanlucpicard.where_values)
203
- assert_equal(["(spaceships_with_2_custom_flags_column.commanders not in (2,3))"], SpaceshipWith2CustomFlagsColumn.not_dajanatroj.where_values)
206
+ assert_where_value "(spaceships_with_2_custom_flags_column.bits not in (1,3))", SpaceshipWith2CustomFlagsColumn.not_warpdrive
207
+ assert_where_value "(spaceships_with_2_custom_flags_column.bits not in (2,3))", SpaceshipWith2CustomFlagsColumn.not_hyperspace
208
+ assert_where_value "(spaceships_with_2_custom_flags_column.commanders not in (1,3))", SpaceshipWith2CustomFlagsColumn.not_jeanlucpicard
209
+ assert_where_value "(spaceships_with_2_custom_flags_column.commanders not in (2,3))", SpaceshipWith2CustomFlagsColumn.not_dajanatroj
204
210
  end
205
-
211
+
206
212
  def test_should_define_a_named_scope_for_flag_enabled_using_bit_operators
207
- assert_equal(["(spaceships.flags & 1 = 1)"], SpaceshipWithBitOperatorQueryMode.warpdrive.where_values)
208
- assert_equal(["(spaceships.flags & 2 = 2)"], SpaceshipWithBitOperatorQueryMode.shields.where_values)
213
+ assert_where_value "(spaceships.flags & 1 = 1)", SpaceshipWithBitOperatorQueryMode.warpdrive
214
+ assert_where_value "(spaceships.flags & 2 = 2)", SpaceshipWithBitOperatorQueryMode.shields
209
215
  end
210
216
 
211
217
  def test_should_define_a_named_scope_for_flag_not_enabled_using_bit_operators
212
- assert_equal(["(spaceships.flags & 1 = 0)"], SpaceshipWithBitOperatorQueryMode.not_warpdrive.where_values)
213
- assert_equal(["(spaceships.flags & 2 = 0)"], SpaceshipWithBitOperatorQueryMode.not_shields.where_values)
218
+ assert_where_value "(spaceships.flags & 1 = 0)", SpaceshipWithBitOperatorQueryMode.not_warpdrive
219
+ assert_where_value "(spaceships.flags & 2 = 0)", SpaceshipWithBitOperatorQueryMode.not_shields
214
220
  end
215
221
 
216
222
  def test_should_return_the_correct_number_of_items_from_a_named_scope
@@ -251,12 +257,20 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
251
257
  assert_equal "(spaceships_with_custom_flags_column.bits not in (1,3))", SpaceshipWithCustomFlagsColumn.not_warpdrive_condition
252
258
  assert_equal "(spaceships_with_custom_flags_column.bits in (2,3))", SpaceshipWithCustomFlagsColumn.hyperspace_condition
253
259
  assert_equal "(spaceships_with_custom_flags_column.bits not in (2,3))", SpaceshipWithCustomFlagsColumn.not_hyperspace_condition
254
- assert_equal(["(spaceships_with_custom_flags_column.bits in (1,3))"], SpaceshipWithCustomFlagsColumn.warpdrive.where_values)
255
- assert_equal(["(spaceships_with_custom_flags_column.bits not in (1,3))"], SpaceshipWithCustomFlagsColumn.not_warpdrive.where_values)
256
- assert_equal(["(spaceships_with_custom_flags_column.bits in (2,3))"], SpaceshipWithCustomFlagsColumn.hyperspace.where_values)
257
- assert_equal(["(spaceships_with_custom_flags_column.bits not in (2,3))"], SpaceshipWithCustomFlagsColumn.not_hyperspace.where_values)
260
+ assert_where_value "(spaceships_with_custom_flags_column.bits in (1,3))", SpaceshipWithCustomFlagsColumn.warpdrive
261
+ assert_where_value "(spaceships_with_custom_flags_column.bits not in (1,3))", SpaceshipWithCustomFlagsColumn.not_warpdrive
262
+ assert_where_value "(spaceships_with_custom_flags_column.bits in (2,3))", SpaceshipWithCustomFlagsColumn.hyperspace
263
+ assert_where_value "(spaceships_with_custom_flags_column.bits not in (2,3))", SpaceshipWithCustomFlagsColumn.not_hyperspace
264
+ end
265
+
266
+ def test_should_work_with_a_custom_flags_column_name_as_symbol
267
+ spaceship = SpaceshipWithColumnNameAsSymol.new
268
+ spaceship.enable_flag(:warpdrive)
269
+ spaceship.save!
270
+ spaceship.reload
271
+ assert_equal 1, spaceship.flags('bits')
258
272
  end
259
-
273
+
260
274
  def test_should_not_error_out_when_table_is_not_present
261
275
  assert_nothing_raised(ActiveRecord::StatementInvalid) do
262
276
  Planet.class_eval do
@@ -265,7 +279,14 @@ class FlagShihTzuClassMethodsTest < Test::Unit::TestCase
265
279
  end
266
280
  end
267
281
  end
268
-
282
+
283
+ private
284
+
285
+ def assert_where_value(expected, scope)
286
+ assert_equal expected,
287
+ ActiveRecord::VERSION::MAJOR == 2 ? scope.proxy_options[:conditions] : scope.where_values.first
288
+ end
289
+
269
290
  end
270
291
 
271
292
  class FlagShihTzuInstanceMethodsTest < Test::Unit::TestCase
@@ -364,6 +385,27 @@ class FlagShihTzuInstanceMethodsTest < Test::Unit::TestCase
364
385
  assert @spaceship.warpdrive
365
386
  end
366
387
 
388
+ def test_should_define_dirty_suffix_changed?
389
+ assert !@spaceship.warpdrive_changed?
390
+ assert !@spaceship.shields_changed?
391
+
392
+ @spaceship.enable_flag(:warpdrive)
393
+ assert @spaceship.warpdrive_changed?
394
+ assert !@spaceship.shields_changed?
395
+
396
+ @spaceship.enable_flag(:shields)
397
+ assert @spaceship.warpdrive_changed?
398
+ assert @spaceship.shields_changed?
399
+
400
+ @spaceship.disable_flag(:warpdrive)
401
+ assert !@spaceship.warpdrive_changed?
402
+ assert @spaceship.shields_changed?
403
+
404
+ @spaceship.disable_flag(:shields)
405
+ assert !@spaceship.warpdrive_changed?
406
+ assert !@spaceship.shields_changed?
407
+ end
408
+
367
409
  def test_should_respect_true_values_like_active_record
368
410
  [true, 1, '1', 't', 'T', 'true', 'TRUE'].each do |true_value|
369
411
  @spaceship.warpdrive = true_value
@@ -375,7 +417,7 @@ class FlagShihTzuInstanceMethodsTest < Test::Unit::TestCase
375
417
  assert !@spaceship.warpdrive
376
418
  end
377
419
  end
378
-
420
+
379
421
  def test_should_ignore_has_flags_call_if_column_does_not_exist_yet
380
422
  assert_nothing_raised do
381
423
  eval(<<-EOF
@@ -390,10 +432,10 @@ class FlagShihTzuInstanceMethodsTest < Test::Unit::TestCase
390
432
  EOF
391
433
  )
392
434
  end
393
-
435
+
394
436
  assert !SpaceshipWithoutFlagsColumn.method_defined?(:warpdrive)
395
437
  end
396
-
438
+
397
439
  def test_should_ignore_has_flags_call_if_column_not_integer
398
440
  assert_raises FlagShihTzu::IncorrectFlagColumnException do
399
441
  eval(<<-EOF
@@ -463,14 +505,14 @@ class FlagShihTzuDerivedClassTest < Test::Unit::TestCase
463
505
  end
464
506
 
465
507
  def test_enable_flag_should_leave_the_flag_enabled_when_called_twice
466
- 2.times do
508
+ 2.times do
467
509
  @spaceship.enable_flag(:warpdrive)
468
510
  assert @spaceship.flag_enabled?(:warpdrive)
469
511
  end
470
512
  end
471
513
 
472
514
  def test_disable_flag_should_leave_the_flag_disabled_when_called_twice
473
- 2.times do
515
+ 2.times do
474
516
  @spaceship.disable_flag(:warpdrive)
475
517
  assert !@spaceship.flag_enabled?(:warpdrive)
476
518
  end
data/test/test_helper.rb CHANGED
@@ -1,35 +1,14 @@
1
- ENV['RAILS_ENV'] = 'test'
2
- ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
1
+ require "test/unit"
2
+ require "yaml"
3
+ require "logger"
4
+ require "flag_shih_tzu"
3
5
 
4
- #exend LOAD_PATH for test with- and without Railsframework
5
- $LOAD_PATH << 'lib/'
6
- $LOAD_PATH << 'vendor/plugins/flag_shih_tzu/lib/'
6
+ ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
7
7
 
8
- require 'test/unit'
9
- require 'yaml'
10
- require 'logger'
11
- require 'rubygems'
12
- gem 'activerecord', '~> 3.0'
13
- require 'active_record'
14
- require 'flag_shih_tzu'
8
+ configs = YAML.load_file(File.dirname(__FILE__) + "/database.yml")
9
+ ActiveRecord::Base.configurations = configs
15
10
 
16
- def load_schema
17
- config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
18
- ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
19
- db_adapter = ENV['DB'] || 'sqlite3'
20
-
21
- # no DB passed, try sqlite3 by default
22
- db_adapter ||=
23
- begin
24
- require 'sqlite3'
25
- 'sqlite3'
26
- rescue MissingSourceFile
27
- end
28
-
29
- if db_adapter.nil?
30
- raise "No DB Adapter selected. Configure test/database.yml and use DB=mysql|postgresql|sqlite3 to pick one. sqlite3 will be used by default (gem install sqlite3-ruby)."
31
- end
32
-
33
- ActiveRecord::Base.establish_connection(config[db_adapter])
34
- load(File.dirname(__FILE__) + "/schema.rb")
35
- end
11
+ db_name = ENV["DB"] || "sqlite"
12
+ ActiveRecord::Base.establish_connection(db_name)
13
+
14
+ load(File.dirname(__FILE__) + "/schema.rb")
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flag_shih_tzu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 961915980
5
- prerelease: 6
4
+ hash: 17
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 0
10
- - pre
11
- version: 0.1.0.pre
8
+ - 2
9
+ - 3
10
+ version: 0.2.3
12
11
  platform: ruby
13
12
  authors:
14
13
  - Patryk Peszko
@@ -19,12 +18,99 @@ autorequire:
19
18
  bindir: bin
20
19
  cert_chain: []
21
20
 
22
- date: 2011-03-09 00:00:00 +03:00
23
- default_executable:
24
- dependencies: []
25
-
21
+ date: 2011-10-31 00:00:00 Z
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: activerecord
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 2
34
+ - 3
35
+ - 0
36
+ version: 2.3.0
37
+ type: :runtime
38
+ version_requirements: *id001
39
+ - !ruby/object:Gem::Dependency
40
+ name: bundler
41
+ prerelease: false
42
+ requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 0
50
+ version: "0"
51
+ type: :development
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: rdoc
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 27
62
+ segments:
63
+ - 2
64
+ - 4
65
+ - 2
66
+ version: 2.4.2
67
+ type: :development
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ type: :development
82
+ version_requirements: *id004
83
+ - !ruby/object:Gem::Dependency
84
+ name: rcov
85
+ prerelease: false
86
+ requirement: &id005 !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ type: :development
96
+ version_requirements: *id005
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ prerelease: false
100
+ requirement: &id006 !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ hash: 3
106
+ segments:
107
+ - 0
108
+ version: "0"
109
+ type: :development
110
+ version_requirements: *id006
26
111
  description: |
27
- This plugin lets you use a single integer column in an ActiveRecord model
112
+ Bit fields for ActiveRecord:
113
+ This gem lets you use a single integer column in an ActiveRecord model
28
114
  to store a collection of boolean attributes (flags). Each flag can be used
29
115
  almost in the same way you would use any boolean attribute on an
30
116
  ActiveRecord object.
@@ -38,10 +124,14 @@ extra_rdoc_files: []
38
124
 
39
125
  files:
40
126
  - .gitignore
127
+ - .travis.yml
41
128
  - Gemfile
42
129
  - README.rdoc
43
130
  - Rakefile
44
131
  - flag_shih_tzu.gemspec
132
+ - gemfiles/Gemfile.activerecord-2.3.x
133
+ - gemfiles/Gemfile.activerecord-3.0.x
134
+ - gemfiles/Gemfile.activerecord-3.1.x
45
135
  - init.rb
46
136
  - lib/flag_shih_tzu.rb
47
137
  - lib/flag_shih_tzu/version.rb
@@ -49,7 +139,6 @@ files:
49
139
  - test/flag_shih_tzu_test.rb
50
140
  - test/schema.rb
51
141
  - test/test_helper.rb
52
- has_rdoc: true
53
142
  homepage: https://github.com/xing/flag_shih_tzu
54
143
  licenses: []
55
144
 
@@ -70,21 +159,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
159
  required_rubygems_version: !ruby/object:Gem::Requirement
71
160
  none: false
72
161
  requirements:
73
- - - ">"
162
+ - - ">="
74
163
  - !ruby/object:Gem::Version
75
- hash: 25
164
+ hash: 3
76
165
  segments:
77
- - 1
78
- - 3
79
- - 1
80
- version: 1.3.1
166
+ - 0
167
+ version: "0"
81
168
  requirements: []
82
169
 
83
170
  rubyforge_project:
84
- rubygems_version: 1.5.2
171
+ rubygems_version: 1.8.6
85
172
  signing_key:
86
173
  specification_version: 3
87
- summary: A rails plugin to store a collection of boolean attributes in a single ActiveRecord column as a bit field
174
+ summary: Bit fields for ActiveRecord
88
175
  test_files:
89
176
  - test/database.yml
90
177
  - test/flag_shih_tzu_test.rb