has_sunspot_scope 0.1 → 0.1.1

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 (2) hide show
  1. data/lib/has_scope.rb +11 -0
  2. metadata +3 -2
data/lib/has_scope.rb CHANGED
@@ -88,6 +88,17 @@ module HasScope
88
88
  end
89
89
  end
90
90
 
91
+ def define_scope_helper_methods
92
+ scopes_configuration.keys.each do |scope|
93
+ instance_eval do
94
+ define_method "#{scope.to_s.singularize}_scope?" do
95
+ current_scopes.has_key?(scope.to_sym)
96
+ end
97
+ end
98
+ end
99
+ helper_method *scopes_configuration.keys.map {|scope| "#{scope.to_s.singularize}_scope?" }
100
+ end
101
+
91
102
  protected
92
103
 
93
104
  # Receives an object where scopes will be applied to.
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_sunspot_scope
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- version: "0.1"
9
+ - 1
10
+ version: 0.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - "Jos\xC3\xA9 Valim"