Module: Respo::Helpers
- Included in:
- Errors::Base, Response
- Defined in:
- lib/respo/helpers.rb
Class Method Summary collapse
- .pluralize(str) ⇒ Object
-
.singularize(str) ⇒ Object
NOTE: only for successes and errors.
Instance Method Summary collapse
Class Method Details
.pluralize(str) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/respo/helpers.rb', line 21 def self.pluralize(str) { error: 'errors', success: 'successes' }[str.to_sym] || str end |
.singularize(str) ⇒ Object
NOTE: only for successes and errors
14 15 16 17 18 19 |
# File 'lib/respo/helpers.rb', line 14 def self.singularize(str) { errors: 'error', successes: 'success' }[str.to_sym] || str end |
Instance Method Details
#action_name(action_class) ⇒ Object
9 10 11 |
# File 'lib/respo/helpers.rb', line 9 def action_name(action_class) action_class.class.name.split('::').last.downcase.to_sym end |
#camelize(str) ⇒ Object
5 6 7 |
# File 'lib/respo/helpers.rb', line 5 def camelize(str) str.split('_').collect(&:capitalize).join end |