pragma-rails 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pragma/rails/resource_controller.rb +11 -2
- data/lib/pragma/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e129956664b085ca518fe2018b0890abae635430
|
4
|
+
data.tar.gz: 5b4d1ff6f57e13410ffa49cfc09727c7e22ba3ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7939abb5ef246412ed0dbff1158671e9d8c5a5630e820463f1492083682c34485a4b73f7cbd2da8db5f9cf391c856705254291d83bb8bf4c1264456126ab56ee
|
7
|
+
data.tar.gz: 3251ec419d8a88149894bf92f24476dbdad0ce2653a9a733fe3c2dbb9cf7f839873a0d61af8935d75a0ff936e4ec70e89f788a77cedeb13599cd43258f6f0f69
|
@@ -12,6 +12,16 @@ module Pragma
|
|
12
12
|
end
|
13
13
|
|
14
14
|
module ClassMethods # :nodoc:
|
15
|
+
# Returns the name of the resource this controller refers to.
|
16
|
+
#
|
17
|
+
# @return [String]
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# API::V1::PostsController.resource_name => 'Post'
|
21
|
+
def resource_name
|
22
|
+
name.demodulize.chomp('Controller').singularize
|
23
|
+
end
|
24
|
+
|
15
25
|
# Returns the expected class of the provided operation on this resource.
|
16
26
|
#
|
17
27
|
# Note that this does not mean the operation is actually supported. Use {#operation?} for
|
@@ -27,8 +37,7 @@ module Pragma
|
|
27
37
|
# API::V1::PostsController.operation_klass(:create) => 'API::V1::Post::Operation::Create'
|
28
38
|
def operation_klass(operation_name)
|
29
39
|
[name.deconstantize].tap do |klass|
|
30
|
-
klass <<
|
31
|
-
klass << "Operation::#{operation_name.to_s.camelize}"
|
40
|
+
klass << "#{resource_name}::Operation::#{operation_name.to_s.camelize}"
|
32
41
|
end.join('::')
|
33
42
|
end
|
34
43
|
|
data/lib/pragma/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pragma-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Desantis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pragma
|