Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/core_ext/hash.rb
Instance Method Summary collapse
Instance Method Details
#permit(*attributes) ⇒ Object
5 6 7 |
# File 'lib/core_ext/hash.rb', line 5 def permit(*attributes) slice(*attributes) end |
#require(key) ⇒ Object
9 10 11 |
# File 'lib/core_ext/hash.rb', line 9 def require(key) self[key].present? ? self[key] : raise(ActionController::ParameterMissing, key) end |
#to_lower_camel_case ⇒ Object
13 14 15 16 17 18 |
# File 'lib/core_ext/hash.rb', line 13 def to_lower_camel_case deep_transform_keys do |key| key = key.to_s.include?('?') ? "is_#{key.to_s.delete('?')}" : key.to_s key.exclude?('_') ? key.to_sym : key.camelize(:lower).to_sym end end |