scopie_rails 0.6.1 → 0.7.0
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.
- checksums.yaml +4 -4
- data/lib/scopie_rails.rb +4 -5
- data/lib/scopie_rails/controller.rb +9 -16
- data/lib/scopie_rails/engine.rb +3 -0
- data/lib/scopie_rails/version.rb +1 -1
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 637fa6d935550c14ae68b73f8af1d4e41ec140d2
|
4
|
+
data.tar.gz: d198127d9506a406623f76c0c901cb6b81b5616c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe4ec28928e8c38321cec9f5a1b48bbe2fc9cbe4ae6048c95254ac410c6f0b9ab05feb473a4419a667481cb725d7c61b5061d7ad8d35182fab86ed0c91d85ee9
|
7
|
+
data.tar.gz: d327ebde39eb70724d32fa882f68fc57faaf06bff4a397c001830421cc76236c77765489e091fb6bb45fde0e3cc4344158a2e8af3a2c9d3a5f5066ec3f7081cf
|
data/lib/scopie_rails.rb
CHANGED
@@ -3,16 +3,15 @@
|
|
3
3
|
require 'scopie'
|
4
4
|
require 'active_support/concern'
|
5
5
|
require 'active_support/core_ext/class/attribute'
|
6
|
-
require 'active_support/core_ext/module/delegation'
|
7
6
|
require 'active_support/core_ext/string/inflections'
|
8
7
|
|
9
8
|
module ScopieRails
|
10
9
|
|
11
|
-
|
12
|
-
SCOPIE_SUFFIX = 'Scopie'
|
13
|
-
CLASS_NAME_DELIMETER = '::'
|
14
|
-
CONTROLLER_DELIMETER = 'Controller'
|
10
|
+
SCOPIE_SUFFIX = '_scopie'
|
15
11
|
|
12
|
+
if defined?(Rails)
|
13
|
+
require 'scopie_rails/engine'
|
14
|
+
end
|
16
15
|
require 'scopie_rails/base'
|
17
16
|
require 'scopie_rails/controller'
|
18
17
|
|
@@ -2,6 +2,10 @@
|
|
2
2
|
module ScopieRails::Controller
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
+
included do
|
6
|
+
class_attribute :scopie_class
|
7
|
+
end
|
8
|
+
|
5
9
|
def default_scopie
|
6
10
|
@default_scopie ||= find_scopie_class.new(self)
|
7
11
|
end
|
@@ -14,24 +18,13 @@ module ScopieRails::Controller
|
|
14
18
|
Scopie.current_scopes(hash, method: hash[:action], scopie: scopie)
|
15
19
|
end
|
16
20
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
def self.find_scopie_class(class_name = nil)
|
21
|
-
return scopie_class if scopie_class
|
22
|
-
|
23
|
-
class_name ||= name
|
21
|
+
def find_scopie_class
|
22
|
+
return self.class.scopie_class if self.class.scopie_class
|
24
23
|
|
25
|
-
|
26
|
-
controller_class_name = ary.pop
|
27
|
-
base_class_name = controller_class_name.split(ScopieRails::CONTROLLER_DELIMETER).first
|
28
|
-
ary << ScopieRails::SCOPIE_PREFIX
|
29
|
-
ary << base_class_name + ScopieRails::SCOPIE_SUFFIX
|
30
|
-
scopie_class = ary.join(ScopieRails::CLASS_NAME_DELIMETER).constantize
|
24
|
+
scopie_name = params[:controller] + ScopieRails::SCOPIE_SUFFIX
|
31
25
|
|
32
|
-
|
33
|
-
end
|
26
|
+
self.class.scopie_class = scopie_name.camelize.constantize
|
34
27
|
|
35
|
-
|
28
|
+
self.class.scopie_class
|
36
29
|
end
|
37
30
|
end
|
data/lib/scopie_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scopie_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yury Kotov
|
@@ -64,6 +64,20 @@ dependencies:
|
|
64
64
|
- - "<"
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '5.1'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: railties
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
type: :runtime
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
67
81
|
- !ruby/object:Gem::Dependency
|
68
82
|
name: rspec
|
69
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,6 +160,7 @@ files:
|
|
146
160
|
- lib/scopie_rails.rb
|
147
161
|
- lib/scopie_rails/base.rb
|
148
162
|
- lib/scopie_rails/controller.rb
|
163
|
+
- lib/scopie_rails/engine.rb
|
149
164
|
- lib/scopie_rails/version.rb
|
150
165
|
homepage: https://github.com/beorc/scopie_rails
|
151
166
|
licenses:
|