pragma-rails 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be66c61ef11055a487cde9b7f67d329d16fc65f6
4
- data.tar.gz: a1419528d6b5f24d95455fd000f9fc6d1835afdf
3
+ metadata.gz: e129956664b085ca518fe2018b0890abae635430
4
+ data.tar.gz: 5b4d1ff6f57e13410ffa49cfc09727c7e22ba3ea
5
5
  SHA512:
6
- metadata.gz: e990a95282b19151965d2e9142c2b65fe1791d83b1c9e4a741ec1653a5df10986d4514633d81b6a9e4f7fa176afa8a3d8c187b67ff1c489f70dc135928b9762b
7
- data.tar.gz: 3e4913fde6f1882c8de97a5012fd7c31561c3a448a8fd246e4c11d6aeec3a22dbc5c4fec19c0cb2f6d4b56a5c00ef4ad1187673f5dca64b6766eb9054811eb83
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 << name.demodulize.chomp('Controller').singularize
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
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Pragma
3
3
  module Rails
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
6
6
  end
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.0.0
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-12 00:00:00.000000000 Z
11
+ date: 2017-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pragma