Class: Hash

Inherits:
Object
  • Object
show all
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

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/api-pattern/class_helpers.rb', line 19

def blank?
  nil? || self == {}
end

#present?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/api-pattern/class_helpers.rb', line 15

def present?
  !blank?
end

#with_indifferent_accessObject



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