sequel-bit_fields 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,12 +53,19 @@ module Sequel::Plugins
53
53
  # returns a hash with all the values of the bit_fields
54
54
  define_method("bit_field_values_for") do |*args|
55
55
  if column_name = [*args].first
56
- hash = {}
56
+ hash = {}
57
+ value = [*args][1]
57
58
 
58
59
  @@bit_fields_for_models[model.to_s][column_name].each do |attribute|
59
60
  hash[attribute.to_sym] = self.send("#{attribute}?".to_sym)
60
61
  end
61
62
 
63
+ unless value.nil?
64
+ hash.dup.each do |key, _value|
65
+ hash.delete(key) unless _value == value
66
+ end
67
+ end
68
+
62
69
  hash
63
70
  else
64
71
  raise 'No bit field name was passed!'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-bit_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-19 00:00:00.000000000 Z
12
+ date: 2013-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel
@@ -49,7 +49,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
49
49
  version: '0'
50
50
  segments:
51
51
  - 0
52
- hash: -4060138488633900959
52
+ hash: 496838917932258262
53
53
  required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  none: false
55
55
  requirements: