periscope 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +6 -14
  2. data/lib/periscope.rb +16 -3
  3. data/periscope.gemspec +1 -1
  4. metadata +5 -5
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YTAyZmQ5NjEyMGU2NmQxZTJhM2JjMjQ1MTBiZGY2MmIxOTdmOTMzNQ==
5
- data.tar.gz: !binary |-
6
- NjMzNTRhN2IxMjNlZGFhNWFmMTU1YmJhMzYxOGYyOGRhZTBmNzc0Ng==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MDZmYjQyZTcyMTdiMzg1Yzg1NmJhYjNiZTI3YmE1ZjJjNDZiNzNkNDFjYWQ4
10
- ZmFkM2I0YTE1NjYwMjg2YmFiMjNkZDEwNGFlZTc1ZWEyNjEwY2E5M2FiYjEw
11
- NWU2ZjlmOWMzYTM2NGVjYmU3MzkzYmUxYTgzYzlkOThlZjMwNWE=
12
- data.tar.gz: !binary |-
13
- Y2Y1MjMzZTcyNDBhYzZlYWZiYmQ3MTE2Njg1NjAwMmViZGQ2OTRlMjQzNGNj
14
- ZjQxZTE2MGMyMWM1YTUyZWQwNGVhMWRhMWVjZmUwZjVlOGJmZWM0OGIyYTc5
15
- MGQ5NjQ4ZDk5MzdhYzVlOGM3Y2E3MDhmMjc1MTQ0YTgxNjU1MzA=
2
+ SHA1:
3
+ metadata.gz: 73fdadba91a54245a65dd7116dac930e9b37d7dd
4
+ data.tar.gz: d4311f892556508ab0dd8dbba78c36a288f71904
5
+ SHA512:
6
+ metadata.gz: e9f17c421acb640572985dc4975ac73a14892049c9b16cef1e35087b88e9c31260e1f3ab916916e7166eb9e7b0f1ab87aee7a8bdd1d71fa4e40c86bd57f48098
7
+ data.tar.gz: 6d78e4502a9f164e3c0543d580310003b4b98063048c18c464686b31aa03a46f4ea90c443c430bff634614d2a3c175955ccbc0018e6c546cc30deec27551c87e
@@ -26,13 +26,26 @@ module Periscope
26
26
  method = periscope_method(scope, options)
27
27
  values = periscope_values(param, options)
28
28
 
29
- if options[:boolean]
30
- values.first ? chain.send(method) : chain
29
+ if periscope_ignore?(values.first, options)
30
+ chain
31
31
  else
32
- chain.send(method, *values)
32
+ options[:boolean] ? chain.send(method) : chain.send(method, *values)
33
33
  end
34
34
  end
35
35
 
36
+ def periscope_ignore?(value, options)
37
+ if options[:ignore_blank]
38
+ periscope_blank?(value)
39
+ elsif options[:boolean]
40
+ !value
41
+ end
42
+ end
43
+
44
+ def periscope_blank?(value)
45
+ return true unless value
46
+ value.respond_to?(:blank?) ? value.blank? : value.empty?
47
+ end
48
+
36
49
  def periscope_method(scope, options)
37
50
  options[:method] || [options[:prefix], scope, options[:suffix]].compact.join
38
51
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "periscope"
5
- gem.version = "2.0.0"
5
+ gem.version = "2.1.0"
6
6
 
7
7
  gem.author = "Steve Richert"
8
8
  gem.email = "steve.richert@gmail.com"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: periscope
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Richert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-06 00:00:00.000000000 Z
11
+ date: 2013-09-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: steve.richert@gmail.com
@@ -30,17 +30,17 @@ require_paths:
30
30
  - lib
31
31
  required_ruby_version: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ! '>='
33
+ - - '>='
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  requirements: []
42
42
  rubyforge_project:
43
- rubygems_version: 2.0.0
43
+ rubygems_version: 2.0.5
44
44
  signing_key:
45
45
  specification_version: 4
46
46
  summary: Push your models' scopes up to the surface