Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/pox_paginate/active_support/core_hash_ext.rb

Class Method Summary collapse

Class Method Details

.from_xml(xml) ⇒ Object



7
8
9
# File 'lib/pox_paginate/active_support/core_hash_ext.rb', line 7

def self.from_xml(xml)
  typecast_xml_value(unrename_keys(remove_pagination_attributes(::ActiveSupport::XmlMini.parse(xml))))
end

.from_xml_without_extensionObject



4
# File 'lib/pox_paginate/active_support/core_hash_ext.rb', line 4

alias_method :from_xml_without_extension, :from_xml

.remove_pagination_attributes(deserialized_xml) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/pox_paginate/active_support/core_hash_ext.rb', line 11

def self.remove_pagination_attributes(deserialized_xml)
  if deserialized_xml.values.size == 1 && deserialized_xml.values.first['type'] == 'array'
    clone = deserialized_xml.clone
    clone.values.first.delete 'per_page'
    clone.values.first.delete 'current_page'
    clone.values.first.delete 'total_entries'
    return clone
  end
  deserialized_xml
end