objectified 0.1.1 → 0.1.2
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/objectified.rb +21 -5
- data/lib/objectified/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c1bcbe160f936336bffc17f7be11c6abfadae1c038300975bf172f0a9d4eced
|
4
|
+
data.tar.gz: 73ad85073e020877367ff247d068c4f9e47538e691b5258a771b855db0c69bac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f568756de79fee41c97cb93d11b0236173f8352e4ab4ac3e42a600df7a15a5cb966b437b383ffbc0418b1e2ece3b624e8ce72f0ebb8ccca425298709f204a489
|
7
|
+
data.tar.gz: 24df7a08a0ff51d654a234e279d23742c0fe05c30ad4d972555aca11e380640032cdb91e64ffe5315c464e5dc413005fd7685a6c79f1e4bc58bda1b8976a22be
|
data/lib/objectified.rb
CHANGED
@@ -64,19 +64,35 @@ module Objectified
|
|
64
64
|
|
65
65
|
|
66
66
|
#
|
67
|
-
# Returns the
|
67
|
+
# Returns the object name regardless of it being plural or singular
|
68
68
|
#
|
69
69
|
# Example:
|
70
|
-
# SomeController.
|
70
|
+
# SomeController.base_klass_string
|
71
|
+
# => 'Some'
|
72
|
+
#
|
73
|
+
# Example:
|
74
|
+
# SomesController.base_klass_string
|
71
75
|
# => 'Somes'
|
72
76
|
#
|
73
77
|
|
74
|
-
def
|
78
|
+
def base_klass_string
|
75
79
|
unless object_type_klass_string
|
76
80
|
raise 'No Object Type Defined. please override object_type in your class => e.g. object_type :controller'
|
77
81
|
end
|
78
82
|
|
79
|
-
to_s.gsub(object_type_klass_string, '')
|
83
|
+
to_s.gsub(object_type_klass_string, '')
|
84
|
+
end
|
85
|
+
|
86
|
+
#
|
87
|
+
# Returns the pluralized resource name
|
88
|
+
#
|
89
|
+
# Example:
|
90
|
+
# SomeController.resources_klass_string
|
91
|
+
# => 'Somes'
|
92
|
+
#
|
93
|
+
|
94
|
+
def resources_klass_string
|
95
|
+
base_klass_string.pluralize
|
80
96
|
end
|
81
97
|
|
82
98
|
|
@@ -89,7 +105,7 @@ module Objectified
|
|
89
105
|
#
|
90
106
|
|
91
107
|
def resources_klass_string
|
92
|
-
|
108
|
+
base_klass_string.singularize
|
93
109
|
end
|
94
110
|
|
95
111
|
|
data/lib/objectified/version.rb
CHANGED