backframe 0.0.11 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2d283b50d4b95937c4c1a2ca673320a31f3843d
4
- data.tar.gz: ab94b8b985cf0602d113a9a735746a69359f8317
3
+ metadata.gz: 41c865ad3f5adda1a6d1799258e50b796f6639f8
4
+ data.tar.gz: 957fa7a9d3177940999662ef37925cc8a310605a
5
5
  SHA512:
6
- metadata.gz: dcb2eac1aec02e8ef1eca1790f0205750b90185fd4c259be010eae5df820cd526343b9352208957b51301b47d3a80605c604bc624360287143db438c60498d59
7
- data.tar.gz: 2b4ed0218a627b7ddf24cc3448c7b521336aee15f3bd57c3f44d7a10d5be8674ca61673ac90301fb56ab3416e5f97daa487daac882095c4efe5da9c3dff14898
6
+ metadata.gz: 1ffb061c4285eba6192b2a6fd163700515a9b072e223c9922f09b59d9c9186a6790ebdcecaf41dd5317862a500b6482bc6558fe7ca0e66c04c1249f75877ce42
7
+ data.tar.gz: 1975fecd01a6503f2d9745e96a35bc120eb5299ab95daf068ab791e1f3aa4cb2ad0d873dde40ca48ed55146271c426d0c554543bfed07765e0b0531421b770fa
@@ -15,7 +15,6 @@ module Backframe
15
15
  field = args[0]
16
16
  arguments = args[1]
17
17
 
18
-
19
18
  if arguments.key?(:required)
20
19
 
21
20
  validates_presence_of field
@@ -38,14 +37,21 @@ module Backframe
38
37
 
39
38
  validates_inclusion_of field, :in => arguments[:in]
40
39
 
40
+ class_eval <<-EOV
41
+ scope :#{field}_is, -> (*options) { where('#{field} IN (?)', (options.is_a?(Array) ? options : [options])) }
42
+ EOV
43
+
44
+ class_eval <<-EOV
45
+ scope :#{field}_not, -> (*options) { where('#{field} NOT IN (?)', (options.is_a?(Array) ? options : [options])) }
46
+ EOV
47
+
41
48
  arguments[:in].each do |option|
42
49
  class_eval <<-EOV
43
- scope :#{field}_#{option}, -> { where(:#{field} => '#{option}') }
50
+ scope :#{field}_#{option}, -> { #{field}_is(option) }
44
51
 
45
52
  def #{field}_#{option}?
46
53
  self.#{field} == '#{option}'
47
54
  end
48
-
49
55
  EOV
50
56
  end
51
57
 
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Backframe
4
- VERSION = '0.0.11'
4
+ VERSION = '0.0.13'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backframe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Kops