skinny_controllers 0.3.1 → 0.3.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8015a9b181b4dcca8b0059d34235fe6305caa669
|
4
|
+
data.tar.gz: ba2e8bf418b39c90f886afd38c4af998ee141e29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adf2864939a3076b97c2ea74e144d6be9939d8e02f9b9c241374741d46ea58ca6e0f34d9c3e814a9842974aa16d6b14742499e9063e39eb69ddf3a69b652cadb
|
7
|
+
data.tar.gz: 0ed96a8334b93b66c54c90efe4350fbf0896e56ca757313b429860da3ff76e40105e8b714613f5cc55465d688b38e323c27f335550979aeebf16907e3b333540
|
@@ -6,7 +6,10 @@ module SkinnyControllers
|
|
6
6
|
# @example ObjectsController => Objects
|
7
7
|
# @return [String] the resource name
|
8
8
|
def resource_name(controller_name)
|
9
|
-
controller_name.gsub('Controller', '')
|
9
|
+
name = controller_name.gsub('Controller', '')
|
10
|
+
# remove the namespace if one exists
|
11
|
+
name.slice! namespace
|
12
|
+
name
|
10
13
|
end
|
11
14
|
|
12
15
|
# @example <ObjectsContreller> => Object
|
@@ -14,10 +17,7 @@ module SkinnyControllers
|
|
14
17
|
def model_name(controller)
|
15
18
|
resource_name = Controller.resource_name(controller)
|
16
19
|
# Convert Resources to Resource
|
17
|
-
|
18
|
-
# remove the namespace if one exists
|
19
|
-
object_name.slice! namespace
|
20
|
-
object_name
|
20
|
+
resource_name.singularize
|
21
21
|
end
|
22
22
|
|
23
23
|
# TODO: add option to configure this per controller
|
@@ -37,7 +37,6 @@ module SkinnyControllers
|
|
37
37
|
# @return [Class] namespace for the default operation class
|
38
38
|
def default_operation_namespace_for(model_name)
|
39
39
|
desired_namespace = namespace_from_model(model_name)
|
40
|
-
|
41
40
|
parent_namespace = SkinnyControllers.operations_namespace
|
42
41
|
namespace = "#{parent_namespace}::#{desired_namespace}".safe_constantize
|
43
42
|
namespace || Object.const_set(desired_namespace, Module.new)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skinny_controllers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- L. Preston Sego III
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -224,5 +224,5 @@ rubyforge_project:
|
|
224
224
|
rubygems_version: 2.4.8
|
225
225
|
signing_key:
|
226
226
|
specification_version: 4
|
227
|
-
summary: SkinnyControllers-0.3.
|
227
|
+
summary: SkinnyControllers-0.3.2
|
228
228
|
test_files: []
|