Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/soaspec/common.rb
Instance Method Summary collapse
-
#each_if_not_null(key) ⇒ Object
Loop through each item within a key within a Hash if the key exists.
Instance Method Details
#each_if_not_null(key) ⇒ Object
Loop through each item within a key within a Hash if the key exists
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/soaspec/common.rb', line 5 def each_if_not_null(key) case key.class.to_s when 'String' if self[key] self[key].each do |list_item| yield(list_item) end end when 'Array' if self[key[0]] if self[key[0]][key[1]] self[key[0]][key[1]].each do |list_item| yield(list_item) end end end end end |