Sha256: d315284d796bd6ed3176820b166d100160e1417756a8d010838b39769cfb21a6

Contents?: true

Size: 643 Bytes

Versions: 11

Compression:

Stored size: 643 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'nokogiri'

module HttpUtilities
  module Http
    module Format
      
      def as_html
        self.parsed_body = (self.body && self.body != "") ? Nokogiri::HTML(self.body, nil, "utf-8") : nil
      end

      def as_xml
        self.parsed_body = (self.body && self.body != "") ? Nokogiri::XML(self.body, nil, "utf-8") : nil
      end
      
      def as_multi_xml
        self.parsed_body = (self.body && self.body != "") ? MultiXml.parse(self.body) : nil
      end

      def as_json
        self.parsed_body = (self.body && self.body != "") ? self.body.to_json : nil
      end
      
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
http_utilities-1.1.2 lib/http_utilities/http/format.rb
http_utilities-1.1.1 lib/http_utilities/http/format.rb
http_utilities-1.1.0 lib/http_utilities/http/format.rb
http_utilities-1.0.9 lib/http_utilities/http/format.rb
http_utilities-1.0.8 lib/http_utilities/http/format.rb
http_utilities-1.0.7.1 lib/http_utilities/http/format.rb
http_utilities-1.0.7 lib/http_utilities/http/format.rb
http_utilities-1.0.6 lib/http_utilities/http/format.rb
http_utilities-1.0.5 lib/http_utilities/http/format.rb
http_utilities-1.0.2 lib/http_utilities/http/format.rb
http_utilities-1.0.1 lib/http_utilities/http/format.rb