Class: String
Instance Method Summary collapse
- #acl_action_mapper ⇒ Object
- #extract_class ⇒ Object
- #extract_settings ⇒ Object
- #remove_prefix ⇒ Object
- #to_resource ⇒ Object
- #typus_constantize ⇒ Object
Instance Method Details
#acl_action_mapper ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/support/string.rb', line 19 def acl_action_mapper case self when "new", "create" "create" when "index", "show", "autocomplete" "read" when "edit", "update", "position", "toggle", "relate", "unrelate" "update" when "destroy", "trash" "delete" else self end end |
#extract_class ⇒ Object
11 12 13 |
# File 'lib/support/string.rb', line 11 def extract_class remove_prefix.classify.typus_constantize end |
#extract_settings ⇒ Object
3 4 5 |
# File 'lib/support/string.rb', line 3 def extract_settings split(",").map { |x| x.strip } end |
#remove_prefix ⇒ Object
7 8 9 |
# File 'lib/support/string.rb', line 7 def remove_prefix split("/")[1..-1].join("/") end |
#to_resource ⇒ Object
34 35 36 |
# File 'lib/support/string.rb', line 34 def to_resource self.underscore.pluralize end |
#typus_constantize ⇒ Object
15 16 17 |
# File 'lib/support/string.rb', line 15 def typus_constantize Typus::Configuration.models_constantized[self] end |