Sha256: d514a59b2097d4bfda25573e80ae5dda36e18894c722da32df6934588ce9b257

Contents?: true

Size: 375 Bytes

Versions: 4

Compression:

Stored size: 375 Bytes

Contents

require 'active_model/serialization'
require 'active_model/serializers/xml.rb'

module Mblox
  class MissingExpectedXmlContentError < StandardError; end

  class << self
    def from_xml(xml)
      begin
        Hash.from_xml(xml)
      rescue REXML::ParseException
        raise MissingExpectedXmlContentError, "'#{xml}' is not parseable as XML"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mblox-0.2.9 lib/mblox/from_xml.rb
mblox-0.2.8 lib/mblox/from_xml.rb
mblox-0.2.7 lib/mblox/from_xml.rb
mblox-0.2.6 lib/mblox/from_xml.rb