attribute-filters 1.4.0 → 2.0.0

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.
Files changed (41) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.yardopts +1 -0
  3. data/ChangeLog +501 -0
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +7 -7
  6. data/Manifest.txt +7 -0
  7. data/README.md +59 -30
  8. data/Rakefile +1 -0
  9. data/attribute-filters.gemspec +4 -4
  10. data/docs/COMMON-FILTERS.md +1067 -0
  11. data/docs/HISTORY +42 -0
  12. data/docs/TODO +29 -12
  13. data/docs/USAGE.md +718 -818
  14. data/lib/attribute-filters.rb +4 -2
  15. data/lib/attribute-filters/attribute_set.rb +144 -73
  16. data/lib/attribute-filters/attribute_set_annotations.rb +110 -77
  17. data/lib/attribute-filters/attribute_set_attrquery.rb +51 -8
  18. data/lib/attribute-filters/attribute_set_enum.rb +44 -38
  19. data/lib/attribute-filters/attribute_set_query.rb +62 -12
  20. data/lib/attribute-filters/backports.rb +36 -4
  21. data/lib/attribute-filters/common_filters.rb +83 -37
  22. data/lib/attribute-filters/common_filters/bare.rb +29 -0
  23. data/lib/attribute-filters/common_filters/case.rb +34 -19
  24. data/lib/attribute-filters/common_filters/convert.rb +259 -0
  25. data/lib/attribute-filters/common_filters/join.rb +37 -30
  26. data/lib/attribute-filters/common_filters/order.rb +105 -0
  27. data/lib/attribute-filters/common_filters/pick.rb +90 -0
  28. data/lib/attribute-filters/common_filters/presence.rb +70 -0
  29. data/lib/attribute-filters/common_filters/split.rb +37 -21
  30. data/lib/attribute-filters/common_filters/squeeze.rb +28 -9
  31. data/lib/attribute-filters/common_filters/strip.rb +7 -3
  32. data/lib/attribute-filters/dsl_attr_virtual.rb +2 -1
  33. data/lib/attribute-filters/dsl_filters.rb +14 -61
  34. data/lib/attribute-filters/dsl_sets.rb +238 -88
  35. data/lib/attribute-filters/helpers.rb +7 -1
  36. data/lib/attribute-filters/meta_set.rb +38 -0
  37. data/lib/attribute-filters/version.rb +1 -1
  38. data/spec/attribute-filters_spec.rb +178 -16
  39. data/spec/spec_helper.rb +9 -4
  40. metadata +129 -69
  41. metadata.gz.sig +0 -0
@@ -40,7 +40,7 @@ module ActiveModel
40
40
  if value.is_a?(Array)
41
41
  value.map { |v| each_element(v, must_be, &block) }
42
42
  elsif value.is_a?(Hash)
43
- value.merge(value) { |k, ov| each_element(ov, must_be, &block) }
43
+ value.each_with_object(value.class.new) { |(k,v),n| n[k] = each_element(v, must_be, &block) }
44
44
  elsif must_be.nil? || value.is_a?(must_be)
45
45
  yield(value)
46
46
  else
@@ -49,6 +49,12 @@ module ActiveModel
49
49
  end
50
50
  module_function :each_element
51
51
 
52
+ # @private
53
+ def safe_dup(src)
54
+ src.respond_to?(:deep_dup) ? src.deep_dup : (src.is_a?(Enumerable) ? src.dup : src)
55
+ end
56
+ module_function :safe_dup
57
+
52
58
  end # module AttributeFiltersHelpers
53
59
  end # module AttributeFilters
54
60
  end # module ActiveModel
@@ -0,0 +1,38 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Author:: Paweł Wilk (mailto:pw@gnu.org)
4
+ # Copyright:: (c) 2012 by Paweł Wilk
5
+ # License:: This program is licensed under the terms of {file:LGPL-LICENSE GNU Lesser General Public License} or {file:COPYING Ruby License}.
6
+ #
7
+ # This file contains ActiveModel::MetaSet class
8
+ # used to store and compare sets of attribute sets.
9
+
10
+ # @abstract This namespace is shared with ActveModel.
11
+ module ActiveModel
12
+ # This is a kind of AttributeSet class
13
+ # but its purpose it so store other information
14
+ # than attribute names.
15
+ class MetaSet < AttributeSet
16
+
17
+ # @private
18
+ def initialize(*args)
19
+ Hash.instance_method(:initialize).bind(self).call(*args)
20
+ end
21
+
22
+ # @private
23
+ def inspect(*args)
24
+ Hash.instance_method(:inspect).bind(self).call(*args)
25
+ end
26
+
27
+ private
28
+
29
+ # Internal method for merging sets.
30
+ def merge_set(my_v, ov, my_class = self.class)
31
+ if my_v.is_a?(my_class) && ov.is_a?(my_class)
32
+ my_v.deep_merge(ov)
33
+ else
34
+ my_v
35
+ end
36
+ end
37
+ end
38
+ end # module ActiveModel
@@ -14,7 +14,7 @@ module ActiveModel
14
14
  # @private
15
15
  EMAIL = 'pw@gnu.org'
16
16
  # @private
17
- VERSION = '1.4.0'
17
+ VERSION = '2.0.0'
18
18
  # @private
19
19
  NAME = 'attribute-filters'
20
20
  # @private
@@ -20,7 +20,7 @@ describe ActiveModel::AttributeFilters do
20
20
  @tm.username = " UPCASEĄĘŚĆ "
21
21
  @tm.email = " Some@EXAMPLE.com "
22
22
  @tm.real_name = " sir rails "
23
- -> { @tm.save }.should_not raise_error
23
+ @tm.save
24
24
  @tm.username.should == "upcaseąęść"
25
25
  @tm.email.should == "Some@EXAMPLE.com"
26
26
  @tm.real_name.should == "Sir Rails"
@@ -69,8 +69,8 @@ describe ActiveModel::AttributeFilters do
69
69
  s.annotate(:email, :operation, :e_value)
70
70
  c.annotate(:real_name, :operation, :some_value)
71
71
  c.annotate(:real_name, :operation, :other_value)
72
- s.instance_eval{annotations}.should == { 'real_name' => { :operation => :first_value }, 'email' => { :operation => :e_value } }
73
- c.instance_eval{annotations}.should == { 'real_name' => { :operation => :other_value } }
72
+ s.should be_eql( { 'real_name' => { :operation => :first_value }, 'email' => { :operation => :e_value }, 'username' => true } )
73
+ c.should be_eql( { 'real_name' => { :operation => :other_value } } )
74
74
  -> {TestModel.class_eval do
75
75
  attributes_that should_be_sth: [ :abc, :atr_one => {:ak => "av"}, :atr_two => {:sk => "sv"} ]
76
76
  attributes_that should_be_sth: [:atr_three, :atr_two, :yy]
@@ -103,7 +103,7 @@ describe ActiveModel::AttributeFilters do
103
103
  @tm.attributes_that(:should_be_sth).annotation(:atr_three, :hh).should == nil
104
104
  dupx = TestModel.attributes_that(:should_be_sth)
105
105
  dupy = @tm.attributes_that(:should_be_sth)
106
- dupx.send(:annotations).should == dupy.send(:annotations)
106
+ dupx.send(:annotations).should be_eql( dupy.send(:annotations) )
107
107
  dupx.object_id.should_not == dupy.object_id
108
108
  -> {TestModel.class_eval do
109
109
  annotate_attributes_that :should_be_sth => { :atr_three => { :cc => "ee" } }
@@ -133,45 +133,45 @@ describe ActiveModel::AttributeFilters do
133
133
  it "should be able to relatively complement sets" do
134
134
  r = @s - @c
135
135
  r.to_a.sort.should == [ "email", "username" ]
136
- r.instance_eval{annotations}.should == { 'email' => { :operation => :e_value } }
136
+ r.should be_eql( { 'email' => { :operation => :e_value }, 'username' => true } )
137
137
  end
138
138
 
139
139
  it "should be able to join sets (union)" do
140
140
  r = @s + @c
141
141
  r.to_a.sort.should == [ "email", "real_name", "username" ]
142
- r.instance_eval{annotations}.should == { 'email' => { :operation => :e_value }, 'real_name' => { :operation => :first_value } }
142
+ r.should be_eql( { 'email' => { :operation => :e_value }, 'real_name' => { :operation => :first_value }, 'username' => true } )
143
143
  end
144
144
 
145
145
  it "should be able to intersect sets" do
146
146
  r = @s & @c
147
147
  r.to_a.sort.should == [ "real_name" ]
148
- r.instance_eval{annotations}.should == { 'real_name' => { :operation => :first_value } }
148
+ r.should be_eql( { 'real_name' => { :operation => :first_value } } )
149
149
  end
150
150
 
151
151
  it "should be able to exclusively disjunct sets" do
152
152
  r = @s ^ @c
153
153
  r.to_a.sort.should == [ "email", "username" ]
154
- r.instance_eval{annotations}.should == { 'email' => { :operation => :e_value } }
154
+ r.should be_eql( { "email" => {:operation=>:e_value}, "username" => true } )
155
155
  sp = @s.dup
156
156
  sp.annotate(:username, 'k', 'v')
157
157
  r = sp ^ @c
158
158
  r.to_a.sort.should == [ "email", "username" ]
159
- r.instance_eval{annotations}.should == { 'email' => { :operation => :e_value }, 'username' => { :k => "v" } }
159
+ r.should be_eql( { 'email' => { :operation => :e_value }, 'username' => { :k => "v" } } )
160
160
  end
161
161
 
162
162
  it "should be able to delete elements from a set" do
163
163
  @s.annotate(:username, :some_key, 'string_val')
164
- @s.instance_eval{annotations}.should == { 'email' => { :operation => :e_value }, 'real_name' => { :operation => :first_value },
165
- 'username' => { :some_key => 'string_val' } }
164
+ @s.should be_eql( { 'email' => { :operation => :e_value }, 'real_name' => { :operation => :first_value },
165
+ 'username' => { :some_key => 'string_val' } })
166
166
  @s.delete_if { |o| o == 'username' }
167
167
  @s.include?('username').should == false
168
- @s.instance_eval{annotations}.should == { 'email' => { :operation => :e_value }, 'real_name' => { :operation => :first_value } }
168
+ @s.should be_eql( { 'email' => { :operation => :e_value }, 'real_name' => { :operation => :first_value } })
169
169
  end
170
170
 
171
171
  it "should be able to keep elements in a set using keep_if" do
172
172
  @s.keep_if { |o| o == 'email' }
173
173
  @s.include?('email').should == true
174
- @s.instance_eval{annotations}.should == { 'email' => { :operation => :e_value } }
174
+ @s.should be_eql( { 'email' => { :operation => :e_value } } )
175
175
  end
176
176
  end
177
177
 
@@ -193,6 +193,164 @@ describe ActiveModel::AttributeFilters do
193
193
  @tm.attributes_that(:should_be_joined).annotation(:real_name).should == nil
194
194
  end
195
195
 
196
+ it "should squeeze attributes" do
197
+ TestModel.class_eval{before_save :squeeze_attributes}
198
+ TestModel.class_eval do
199
+ attributes_that :should_be_squeezed, :sq_one
200
+ attributes_that :should_be_squeezed, :sq_six => { :squeeze_other_str => 'l' }
201
+ squeeze_attributes :sq_two => 'o'
202
+ squeeze_attributes :sq_three => { :with_character => 'o' }, :sq_four => 'o', :sq_five => nil
203
+ squeeze_attributes :sq_eight, :sq_seven
204
+ end
205
+ @tm.sq_one = @tm.sq_two = @tm.sq_three = @tm.sq_four = @tm.sq_five = @tm.sq_six = @tm.sq_seven = @tm.sq_eight = 'yellow moon'
206
+ -> { @tm.save }.should_not raise_error
207
+ @tm.sq_one.should == 'yelow mon'
208
+ @tm.sq_two.should == 'yellow mon'
209
+ @tm.sq_three.should == 'yellow mon'
210
+ @tm.sq_four.should == 'yellow mon'
211
+ @tm.sq_five.should == 'yelow mon'
212
+ @tm.sq_six.should == 'yelow moon'
213
+ @tm.sq_seven.should == 'yelow mon'
214
+ @tm.sq_eight.should == 'yelow mon'
215
+ end
216
+
217
+ it "should pick attributes" do
218
+ TestModel.class_eval do
219
+ attributes_that :should_be_picked, :p_a
220
+ attributes_that :should_be_picked, :p_b => { :pick_separator => " " }
221
+ pick_attributes :p_c, :p_d
222
+ pick_attributes :p_e => / /
223
+ pick_attributes :p_f => { :separator => " ", :from => 1 }
224
+ pick_attributes :p_g => { :from => 2, :to => 3 }
225
+ pick_attributes :p_h => { :range => 2..3 }
226
+ pick_attributes :p_i => { :step => 2, :from => 2, :separator => " " }
227
+ pick_attributes :p_j => { :step => 2, :tail => 2, :separator => " " }
228
+ pick_attributes :p_k => { :joiner => "x", :separator => " ", :head => 1 }
229
+ pick_attributes :p_l => { :head => 2, :step => 2 }
230
+ pick_attributes :p_m => { :enum => true, :head => 2, :step => 2 }
231
+ pick_attributes :p_n => { :enum => true, :head => 2, :step => 2 }
232
+ pick_attributes :p_o => { :head => 2, :step => 2 }
233
+ end
234
+ @tm.p_a = @tm.p_b = @tm.p_c = @tm.p_d = @tm.p_e = @tm.p_f = @tm.p_g = @tm.p_h =
235
+ @tm.p_i = @tm.p_j = @tm.p_k = "one two three four five"
236
+ @tm.p_l = @tm.p_m = @tm.p_a.split(" ")
237
+ @tm.p_n = @tm.p_o = { :a => 'one', :b => 'two', :c => 'three', :d => 'four', :e => 'five' }
238
+ -> { @tm.save }.should_not raise_error
239
+ @tm.p_a.should == "one two three four five"
240
+ @tm.p_b.should == "one two three four five"
241
+ @tm.p_c.should == "one two three four five"
242
+ @tm.p_d.should == "one two three four five"
243
+ @tm.p_e.should == "onetwothreefourfive"
244
+ @tm.p_f.should == "two three four five"
245
+ @tm.p_g.should == "e "
246
+ @tm.p_h.should == "e "
247
+ @tm.p_i.should == "three five"
248
+ @tm.p_j.should == "one three"
249
+ @tm.p_k.should == "twoxthreexfourxfive"
250
+ @tm.p_l.should == ["e", "o", "re", "u", "v"]
251
+ @tm.p_m.should == ["three", "five"]
252
+ @tm.p_n.should == { 'c' => 'three', 'e' => 'five' }
253
+ @tm.p_o.should == { 'a' => 'e', 'b' => 'o', 'c' => 're', 'd' => 'u', 'e' => 'v' }
254
+ end
255
+
256
+ it "should fill attributes with values" do
257
+ TestModel.class_eval{before_save :fill_attributes}
258
+ TestModel.class_eval do
259
+ attributes_that :should_be_filled, :fill_one
260
+ attributes_that :should_be_filled, :fill_two => { :fill_value => 'dupa' }
261
+ attributes_that :should_be_filled, :fill_three => { :fill_value => 'dupa', :fill_any => true }
262
+ fill_attributes :fill_four => 'dupa'
263
+ fill_attributes :fill_five => { :with => 'dupa', :fill_present => true }
264
+ fill_attributes :fill_six => { :with => 'dupa' }
265
+ fill_attributes :fill_seven => { :with => 'dupa', :always => true }
266
+ fill_attributes :fill_eight => { :with => 'dupa', :enums => true }
267
+ fill_attributes :fill_nine => { :with => 'dupa', :always => true, :enums => true }
268
+ fill_attributes :fill_ten => { :with => 'dupa' }
269
+ end
270
+ @tm.fill_one = ''
271
+ @tm.fill_five = @tm.fill_three = 'something'
272
+ @tm.fill_two = @tm.fill_four = @tm.fill_six = nil
273
+ @tm.fill_seven = @tm.fill_eight = @tm.fill_nine = @tm.fill_ten = ['1',2,:x,nil,'']
274
+ -> { @tm.save }.should_not raise_error
275
+ @tm.fill_one.should == nil
276
+ @tm.fill_two.should == 'dupa'
277
+ @tm.fill_three.should == 'dupa'
278
+ @tm.fill_four.should == 'dupa'
279
+ @tm.fill_five.should == 'dupa'
280
+ @tm.fill_six.should == 'dupa'
281
+ @tm.fill_seven.should == ['dupa','dupa','dupa','dupa','dupa']
282
+ @tm.fill_eight.should == ['1',2,:x,nil,'']
283
+ @tm.fill_nine.should == 'dupa'
284
+ @tm.fill_ten.should == ['1',2,:x,'dupa','dupa']
285
+ end
286
+
287
+ it "should reverse attribute values" do
288
+ TestModel.class_eval do
289
+ attributes_that :should_be_reversed, :reverse_one
290
+ attributes_that :should_be_reversed, :reverse_two => { :reverse_enumerable => true }
291
+ reverse_attributes :reverse_three => { :enums => true }
292
+ reverse_attributes :reverse_four
293
+ end
294
+ @tm.reverse_one = @tm.reverse_two = 'dupa'
295
+ @tm.reverse_three = @tm.reverse_four = ['1',2,:x,'dupa']
296
+ -> { @tm.save }.should_not raise_error
297
+ @tm.reverse_one.should == 'apud'
298
+ @tm.reverse_two.should == 'apud'
299
+ @tm.reverse_three.should == ['dupa',:x,2,'1']
300
+ @tm.reverse_four.should == ['1',2,:x,'apud']
301
+ end
302
+
303
+ it "should randomize order of attribute values" do
304
+ TestModel.class_eval{before_save :shuffle_attributes}
305
+ TestModel.class_eval do
306
+ attributes_that :should_be_shuffled, :shuffle_one, :shuffle_two
307
+ shuffle_attributes :shuffle_three => { :enums => true }
308
+ shuffle_attributes :shuffle_four
309
+ end
310
+ @tm.shuffle_one = @tm.shuffle_two = 'dupa'
311
+ @tm.shuffle_three = @tm.shuffle_four = ['1',2,:x,2,'dupadupa']
312
+ -> { @tm.save }.should_not raise_error
313
+ @tm.shuffle_one.split("").sort.should == @tm.shuffle_two.split("").sort
314
+ @tm.shuffle_three.sort{ |a,b| a.to_s <=> b.to_s}.should == ['1',2,:x,2,'dupadupa'].sort{ |a,b| a.to_s <=> b.to_s}
315
+ @tm.shuffle_four.take(3).should == ['1',2,:x]
316
+ @tm.shuffle_four.last.should_not == 'dupadupa'
317
+ end
318
+
319
+ it "should convert attributes" do
320
+ TestModel.class_eval do
321
+ attributes_that :should_be_strings, :to_strings => { :base => 10 }
322
+ attributes_that :should_be_integers, :to_integers
323
+ convert_to_float :to_floats
324
+ convert_to_string :to_strings_two
325
+ convert_to_string :to_strings_three => 2
326
+ convert_to_string :to_strings_four => { :base => 2, :default => "7" }
327
+ convert_to_fraction :to_fractions
328
+ convert_to_number :to_numbers
329
+ convert_to_integer :to_integers_two => 2
330
+ convert_to_boolean :to_boolean
331
+ end
332
+ @tm.to_strings = 5
333
+ @tm.to_strings_two = @tm.to_strings_four = 0.5.to_r
334
+ @tm.to_strings_three = 123
335
+ @tm.to_integers = "12"
336
+ @tm.to_integers_two = "10001"
337
+ @tm.to_floats = "12.1234"
338
+ @tm.to_fractions = "1/2"
339
+ @tm.to_numbers = [ "1", 2, "3" ]
340
+ @tm.to_boolean = nil
341
+ @tm.save
342
+ @tm.to_strings.should == "5"
343
+ @tm.to_strings_two.should == "1/2"
344
+ @tm.to_strings_four.should == "7"
345
+ @tm.to_strings_three.should == "1111011"
346
+ @tm.to_integers.should == 12
347
+ @tm.to_floats.should == 12.1234
348
+ @tm.to_fractions.should == "1/2".to_r
349
+ @tm.to_numbers.should == [ 1, 2, 3 ]
350
+ @tm.to_integers_two.should == 17
351
+ @tm.to_boolean.should === false
352
+ end
353
+
196
354
  shared_examples "splitting" do |ev|
197
355
  before { TestModel.class_eval{before_save :split_attributes} }
198
356
  it "should split attributes using syntax: #{ev}" do
@@ -200,7 +358,6 @@ describe ActiveModel::AttributeFilters do
200
358
  @tm.real_name = "Paweł Wilk Trzy"
201
359
  @tm.first_name = nil
202
360
  @tm.last_name = nil
203
- #-> { @tm.save }.should_not raise_error
204
361
  @tm.save
205
362
  @tm.first_name.should == 'Paweł'
206
363
  @tm.last_name.should == 'Wilk'
@@ -304,7 +461,12 @@ describe ActiveModel::AttributeFilters do
304
461
  @tm.last_name.should == nil
305
462
  @tm.real_name.should == ["Paweł", "Wilk", "Trzy", "Cztery"]
306
463
 
307
- TestModel.class_eval{split_attribute :real_name => {:limit => 2}}
464
+ TestModel.class_eval{split_attribute :real_name => {:limit => 2, :flatten => true}}
465
+ @tm.real_name = ["Paweł", "Wilk Trzy Osiem Dziewiec", "Cztery"]
466
+ -> { @tm.save }.should_not raise_error
467
+ @tm.real_name.should == ["Paweł", "Wilk", "Trzy Osiem Dziewiec", "Cztery"]
468
+
469
+ TestModel.class_eval{split_attribute :real_name => {:limit => 2, :flatten => false}}
308
470
  @tm.real_name = ["Paweł", "Wilk Trzy Osiem Dziewiec", "Cztery"]
309
471
  -> { @tm.save }.should_not raise_error
310
472
  @tm.real_name.should == [["Paweł"], ["Wilk", "Trzy Osiem Dziewiec"], ["Cztery"]]
@@ -332,7 +494,7 @@ describe ActiveModel::AttributeFilters do
332
494
  @tm.real_name = rn
333
495
  @tm.first_name = "Paweł"
334
496
  @tm.last_name = "Wilk"
335
- -> { @tm.save }.should_not raise_error
497
+ @tm.save
336
498
  @tm.first_name.should == 'Paweł'
337
499
  @tm.last_name.should == 'Wilk'
338
500
  @tm.real_name.should == 'Paweł Wilk'
data/spec/spec_helper.rb CHANGED
@@ -21,14 +21,12 @@ class TestModel < SuperModel::Base
21
21
  attributes_that should_be_titleized: [ :real_name ]
22
22
  attributes_that should_be_squeezed: [ :real_name ]
23
23
  attributes_that should_be_tested: [ :test_attribute ]
24
+ attributes_that should_be_effed: [ :ef_attribute ]
24
25
  attributes_that do_not_exist: [ :nonexistent_attribute ]
25
26
 
26
27
  the_attribute username: [ :should_be_stripped, :should_be_downcased ]
27
28
 
28
- before_save :strip_attributes
29
- before_save :downcase_attributes
30
- before_save :titleize_attributes
31
- before_save :squeeze_attributes
29
+ before_save :filter_attributes
32
30
 
33
31
  def touch_nonexistent
34
32
  filter_attributes_that :do_not_exist do |atr|
@@ -42,4 +40,11 @@ class TestModel < SuperModel::Base
42
40
  end
43
41
  end
44
42
 
43
+ def my_filtering_method
44
+ filter_attributes_that :should_be_effed do |atr|
45
+ atr + "F"
46
+ end
47
+ end
48
+ filtering_method :my_filtering_method, :should_be_effed
49
+
45
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attribute-filters
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,50 +9,38 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
- - ! '-----BEGIN CERTIFICATE-----
13
-
14
- MIIDKjCCAhKgAwIBAgIBADANBgkqhkiG9w0BAQUFADA7MQ8wDQYDVQQDDAZzaWVm
15
-
16
- Y2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c4NlZW
27
+ UCs4RXFiSktKT1M5NXhsbVFUSGpQSzU2eVh2OEdpdXlMUUhwUGg1QWdNQkFB
28
+ R2oKT1RBM01Ba0dBMVVkRXdRQ01BQXdIUVlEVlIwT0JCWUVGS09Lc3BaT05x
29
+ NGJ0NUQyREVleEIrdnNNQjJHTUFzRwpBMVVkRHdRRUF3SUVzREFOQmdrcWhr
30
+ aUc5dzBCQVFVRkFBT0NBUUVBVWgwTG5CNG81WEtwSDN5T3hhdkV5cDlYCk5l
31
+ bjJlODU0d3NTakFyMHdhU1Z6RXQzWHhZMXZveUlFNldDR3haSlUvLzQwQ1Iw
32
+ QmU3ajVDY3NKc0RVMkNaeVoKOFNYTjEvbVpqTXFXdll5RU1TZlFQNFh6a0ZT
33
+ T3V5RGNvREFmNDNPR2hPaGR2NUpjcy9FdC9GSDZEZ1dZd1J4cQpSdEFUUldP
34
+ TjVSOTl1Z1BlUmI3aTFuSXBuekdFQkE5VjMycjZyOTU5QnAzWGprVkVYeWxi
35
+ SXRZTXFTQVJhWmxZCnF6S1NzSVVqaDd2RHlUTnF0YTBEalNnQ2syNmRobk93
36
+ YzBobXpodlZadEJ3ZlpyaXRTVmhmQ0xwNXVGd3FDcVkKTkszVElaYVBDaDFT
37
+ Mi9FUzZ3WE52alErNUVuRUVMOWovcFNFb3A5RFlFQlBhTTJXRFZSNWkwakpU
38
+ QWFSV3c9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
+ date: 2012-11-01 00:00:00.000000000 Z
52
40
  dependencies:
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: railties
55
- requirement: &2160679860 !ruby/object:Gem::Requirement
43
+ requirement: !ruby/object:Gem::Requirement
56
44
  none: false
57
45
  requirements:
58
46
  - - ~>
@@ -60,10 +48,15 @@ dependencies:
60
48
  version: '3.0'
61
49
  type: :runtime
62
50
  prerelease: false
63
- version_requirements: *2160679860
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: '3.0'
64
57
  - !ruby/object:Gem::Dependency
65
58
  name: activemodel
66
- requirement: &2160678280 !ruby/object:Gem::Requirement
59
+ requirement: !ruby/object:Gem::Requirement
67
60
  none: false
68
61
  requirements:
69
62
  - - ~>
@@ -71,10 +64,15 @@ dependencies:
71
64
  version: '3.0'
72
65
  type: :runtime
73
66
  prerelease: false
74
- version_requirements: *2160678280
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ version: '3.0'
75
73
  - !ruby/object:Gem::Dependency
76
74
  name: hoe-yard
77
- requirement: &2160676540 !ruby/object:Gem::Requirement
75
+ requirement: !ruby/object:Gem::Requirement
78
76
  none: false
79
77
  requirements:
80
78
  - - ! '>='
@@ -82,10 +80,15 @@ dependencies:
82
80
  version: 0.1.2
83
81
  type: :development
84
82
  prerelease: false
85
- version_requirements: *2160676540
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: 0.1.2
86
89
  - !ruby/object:Gem::Dependency
87
90
  name: rspec
88
- requirement: &2160825180 !ruby/object:Gem::Requirement
91
+ requirement: !ruby/object:Gem::Requirement
89
92
  none: false
90
93
  requirements:
91
94
  - - ! '>='
@@ -93,10 +96,15 @@ dependencies:
93
96
  version: 2.6.0
94
97
  type: :development
95
98
  prerelease: false
96
- version_requirements: *2160825180
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: 2.6.0
97
105
  - !ruby/object:Gem::Dependency
98
106
  name: yard
99
- requirement: &2160718640 !ruby/object:Gem::Requirement
107
+ requirement: !ruby/object:Gem::Requirement
100
108
  none: false
101
109
  requirements:
102
110
  - - ! '>='
@@ -104,10 +112,15 @@ dependencies:
104
112
  version: 0.8.2
105
113
  type: :development
106
114
  prerelease: false
107
- version_requirements: *2160718640
115
+ version_requirements: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: 0.8.2
108
121
  - !ruby/object:Gem::Dependency
109
122
  name: rdoc
110
- requirement: &2160717660 !ruby/object:Gem::Requirement
123
+ requirement: !ruby/object:Gem::Requirement
111
124
  none: false
112
125
  requirements:
113
126
  - - ! '>='
@@ -115,10 +128,15 @@ dependencies:
115
128
  version: 3.8.0
116
129
  type: :development
117
130
  prerelease: false
118
- version_requirements: *2160717660
131
+ version_requirements: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: 3.8.0
119
137
  - !ruby/object:Gem::Dependency
120
138
  name: redcarpet
121
- requirement: &2160716640 !ruby/object:Gem::Requirement
139
+ requirement: !ruby/object:Gem::Requirement
122
140
  none: false
123
141
  requirements:
124
142
  - - ! '>='
@@ -126,10 +144,15 @@ dependencies:
126
144
  version: 2.1.0
127
145
  type: :development
128
146
  prerelease: false
129
- version_requirements: *2160716640
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: 2.1.0
130
153
  - !ruby/object:Gem::Dependency
131
154
  name: supermodel
132
- requirement: &2160715480 !ruby/object:Gem::Requirement
155
+ requirement: !ruby/object:Gem::Requirement
133
156
  none: false
134
157
  requirements:
135
158
  - - ! '>='
@@ -137,10 +160,15 @@ dependencies:
137
160
  version: 0.1.6
138
161
  type: :development
139
162
  prerelease: false
140
- version_requirements: *2160715480
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ none: false
165
+ requirements:
166
+ - - ! '>='
167
+ - !ruby/object:Gem::Version
168
+ version: 0.1.6
141
169
  - !ruby/object:Gem::Dependency
142
170
  name: activerecord
143
- requirement: &2160714400 !ruby/object:Gem::Requirement
171
+ requirement: !ruby/object:Gem::Requirement
144
172
  none: false
145
173
  requirements:
146
174
  - - ! '>='
@@ -148,10 +176,15 @@ dependencies:
148
176
  version: '3.0'
149
177
  type: :development
150
178
  prerelease: false
151
- version_requirements: *2160714400
179
+ version_requirements: !ruby/object:Gem::Requirement
180
+ none: false
181
+ requirements:
182
+ - - ! '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '3.0'
152
185
  - !ruby/object:Gem::Dependency
153
186
  name: bundler
154
- requirement: &2160712740 !ruby/object:Gem::Requirement
187
+ requirement: !ruby/object:Gem::Requirement
155
188
  none: false
156
189
  requirements:
157
190
  - - ! '>='
@@ -159,10 +192,15 @@ dependencies:
159
192
  version: 1.0.10
160
193
  type: :development
161
194
  prerelease: false
162
- version_requirements: *2160712740
195
+ version_requirements: !ruby/object:Gem::Requirement
196
+ none: false
197
+ requirements:
198
+ - - ! '>='
199
+ - !ruby/object:Gem::Version
200
+ version: 1.0.10
163
201
  - !ruby/object:Gem::Dependency
164
202
  name: hoe-bundler
165
- requirement: &2160842460 !ruby/object:Gem::Requirement
203
+ requirement: !ruby/object:Gem::Requirement
166
204
  none: false
167
205
  requirements:
168
206
  - - ! '>='
@@ -170,10 +208,15 @@ dependencies:
170
208
  version: 1.1.0
171
209
  type: :development
172
210
  prerelease: false
173
- version_requirements: *2160842460
211
+ version_requirements: !ruby/object:Gem::Requirement
212
+ none: false
213
+ requirements:
214
+ - - ! '>='
215
+ - !ruby/object:Gem::Version
216
+ version: 1.1.0
174
217
  - !ruby/object:Gem::Dependency
175
218
  name: hoe-gemspec
176
- requirement: &2160839620 !ruby/object:Gem::Requirement
219
+ requirement: !ruby/object:Gem::Requirement
177
220
  none: false
178
221
  requirements:
179
222
  - - ! '>='
@@ -181,10 +224,15 @@ dependencies:
181
224
  version: 1.0.0
182
225
  type: :development
183
226
  prerelease: false
184
- version_requirements: *2160839620
227
+ version_requirements: !ruby/object:Gem::Requirement
228
+ none: false
229
+ requirements:
230
+ - - ! '>='
231
+ - !ruby/object:Gem::Version
232
+ version: 1.0.0
185
233
  - !ruby/object:Gem::Dependency
186
234
  name: hoe
187
- requirement: &2160838420 !ruby/object:Gem::Requirement
235
+ requirement: !ruby/object:Gem::Requirement
188
236
  none: false
189
237
  requirements:
190
238
  - - ~>
@@ -192,7 +240,12 @@ dependencies:
192
240
  version: '2.16'
193
241
  type: :development
194
242
  prerelease: false
195
- version_requirements: *2160838420
243
+ version_requirements: !ruby/object:Gem::Requirement
244
+ none: false
245
+ requirements:
246
+ - - ~>
247
+ - !ruby/object:Gem::Version
248
+ version: '2.16'
196
249
  description: Concise way of filtering model attributes in Rails.
197
250
  email:
198
251
  - pw@gnu.org
@@ -211,6 +264,7 @@ files:
211
264
  - README.md
212
265
  - Rakefile
213
266
  - attribute-filters.gemspec
267
+ - docs/COMMON-FILTERS.md
214
268
  - docs/COPYING
215
269
  - docs/HISTORY
216
270
  - docs/LEGAL
@@ -229,8 +283,13 @@ files:
229
283
  - lib/attribute-filters/attribute_set_query.rb
230
284
  - lib/attribute-filters/backports.rb
231
285
  - lib/attribute-filters/common_filters.rb
286
+ - lib/attribute-filters/common_filters/bare.rb
232
287
  - lib/attribute-filters/common_filters/case.rb
288
+ - lib/attribute-filters/common_filters/convert.rb
233
289
  - lib/attribute-filters/common_filters/join.rb
290
+ - lib/attribute-filters/common_filters/order.rb
291
+ - lib/attribute-filters/common_filters/pick.rb
292
+ - lib/attribute-filters/common_filters/presence.rb
234
293
  - lib/attribute-filters/common_filters/split.rb
235
294
  - lib/attribute-filters/common_filters/squeeze.rb
236
295
  - lib/attribute-filters/common_filters/strip.rb
@@ -238,6 +297,7 @@ files:
238
297
  - lib/attribute-filters/dsl_filters.rb
239
298
  - lib/attribute-filters/dsl_sets.rb
240
299
  - lib/attribute-filters/helpers.rb
300
+ - lib/attribute-filters/meta_set.rb
241
301
  - lib/attribute-filters/railtie.rb
242
302
  - lib/attribute-filters/version.rb
243
303
  - spec/attribute-filters_spec.rb
@@ -260,7 +320,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
260
320
  version: '0'
261
321
  segments:
262
322
  - 0
263
- hash: -50448779871167899
323
+ hash: 3287018804216042017
264
324
  required_rubygems_version: !ruby/object:Gem::Requirement
265
325
  none: false
266
326
  requirements:
@@ -269,7 +329,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
269
329
  version: '0'
270
330
  requirements: []
271
331
  rubyforge_project: attribute-filters
272
- rubygems_version: 1.8.11
332
+ rubygems_version: 1.8.24
273
333
  signing_key:
274
334
  specification_version: 3
275
335
  summary: Concise way of filtering model attributes in Rails