Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/api-pattern/class_helpers.rb
Overview
ClassHelpers Used to give some of the quality of life methods Rails would usually provide TODO: May need to evaluate using these
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #present? ⇒ Boolean
- #with_indifferent_access ⇒ Object
- #with_indifferent_access! ⇒ Object
Instance Method Details
#blank? ⇒ Boolean
19 20 21 |
# File 'lib/api-pattern/class_helpers.rb', line 19 def blank? nil? || self == {} end |
#present? ⇒ Boolean
15 16 17 |
# File 'lib/api-pattern/class_helpers.rb', line 15 def present? !blank? end |
#with_indifferent_access ⇒ Object
5 6 7 |
# File 'lib/api-pattern/class_helpers.rb', line 5 def with_indifferent_access dup.with_indifferent_access! end |
#with_indifferent_access! ⇒ Object
9 10 11 12 13 |
# File 'lib/api-pattern/class_helpers.rb', line 9 def with_indifferent_access! keys.each { |key| resolve(key) } self end |