Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/aliyun_mns.rb

Class Method Summary collapse

Class Method Details

.xml_array(content, *path) ⇒ Object



9
10
11
12
# File 'lib/aliyun_mns.rb', line 9

def self.xml_array content, *path
  o = xml_object(content, *path)
  return (o.is_a?(Array) ? o : [o]).reject { |n| n.empty? }
end

.xml_object(content, *path) ⇒ Object



14
15
16
17
# File 'lib/aliyun_mns.rb', line 14

def self.xml_object content, *path
  h = from_xml(content)
  path.reduce(h) { |memo, node| memo = memo[node] || {} }
end