Class: Aegis::Normalization
- Inherits:
-
Object
- Object
- Aegis::Normalization
- Defined in:
- lib/aegis/normalization.rb
Constant Summary collapse
- VERB_NORMALIZATIONS =
{ "edit" => "update", "show" => "read", "list" => "read", "view" => "read", "delete" => "destroy", "remove" => "destroy" }
Class Method Summary collapse
Class Method Details
.normalize_permission(permission) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/aegis/normalization.rb', line 17 def self.() if =~ /^([^_]+?)_(.+?)$/ verb, target = $1, $2 = normalize_verb(verb) + "_" + target end end |
.normalize_verb(verb) ⇒ Object
13 14 15 |
# File 'lib/aegis/normalization.rb', line 13 def self.normalize_verb(verb) VERB_NORMALIZATIONS[verb] || verb end |