scopie 1.0.1 → 1.0.2

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: fe59078e2e2798ce9fb21bfbaf5d84073832fec1
4
- data.tar.gz: 04be530e19f3441fb2b4255558c5c5d5ce98628b
3
+ metadata.gz: 879319e399691c122f8202cc78ecf59acf738d60
4
+ data.tar.gz: f2c747c9a891dca955f175e7b351900af5cce454
5
5
  SHA512:
6
- metadata.gz: d33e2a61b45ff6a8d14384a70d3e0a4cbf48b4236ed172c21b0bcf4d3ec261f628984d49fafe5802931bddb3242939057126e6b8c6f0a1299bdc94b5d5da0a76
7
- data.tar.gz: b0ebe558815608b0b9f581f61a3b00ea0be147e16bf8848c30b85503573c16596534c4aeec10c4745f5aaa6b61ecd2d55e43ae91af131a47e7317022f0782893
6
+ metadata.gz: e50053ba1c7a8817dc0960cbe47640c9a588f2944539bdd608cf42b03b9022ac110c970c6ae60f82c7b0fad5db6f902321d57925645fcb2bd7fd494b28c7a457
7
+ data.tar.gz: 2361436b73bf383a370817d48b305d6a0b05d322f22841ea1109ce76eb9ba888d412abfbe46172e28f0503aabfd97cc81ef236b4746cde434b253d02c68834a5
data/README.md CHANGED
@@ -14,7 +14,7 @@ Motivation:
14
14
 
15
15
  * Dedicated class for scopes mapping, so that the logic is isolated and your controller is skinny.
16
16
  * Dependencies free. Please have a look at [scopie_rails](http://github.com/beorc/scopie_rails) if you are using Ruby on Rails framework.
17
- * Ability to override default mapping behavior by definition of a method with the same name as scope in the scopie class.
17
+ * Ability to override default mapping behavior by definition of a method having the same name as a scope in the scopie class.
18
18
  * Ability to use the object oriented approach to DRY your custom scopes mapping logic and reuse the scopie class.
19
19
 
20
20
  Imagine the following model called graduations:
data/lib/scopie/base.rb CHANGED
@@ -47,7 +47,8 @@ class Scopie::Base
47
47
  target.public_send(scope_name, value)
48
48
  end
49
49
 
50
- result || target
50
+ return target if Scopie::RESULTS_TO_IGNORE.include?(result)
51
+ result
51
52
  end
52
53
 
53
54
  def key_name(scope_name, options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Scopie
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.2'
5
5
  end
data/lib/scopie.rb CHANGED
@@ -4,6 +4,8 @@ module Scopie
4
4
 
5
5
  class InvalidOptionError < StandardError; end
6
6
 
7
+ RESULTS_TO_IGNORE = [true, false].freeze
8
+
7
9
  require 'scopie/value'
8
10
  require 'scopie/base'
9
11
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scopie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Kotov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-26 00:00:00.000000000 Z
11
+ date: 2016-06-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Minimal mapping of incoming parameters to named scopes in your resources
14
14
  through OO design and pure Ruby classes