Class: HTTPX::Transcoder::Xml::Encoder
- Inherits:
-
Object
- Object
- HTTPX::Transcoder::Xml::Encoder
- Defined in:
- lib/httpx/transcoder/xml.rb
Instance Method Summary collapse
- #bytesize ⇒ Object
- #content_type ⇒ Object
-
#initialize(xml) ⇒ Encoder
constructor
A new instance of Encoder.
- #to_s ⇒ Object
Constructor Details
#initialize(xml) ⇒ Encoder
Returns a new instance of Encoder.
14 15 16 |
# File 'lib/httpx/transcoder/xml.rb', line 14 def initialize(xml) @raw = xml end |
Instance Method Details
#bytesize ⇒ Object
23 24 25 |
# File 'lib/httpx/transcoder/xml.rb', line 23 def bytesize @raw.to_s.bytesize end |
#content_type ⇒ Object
18 19 20 21 |
# File 'lib/httpx/transcoder/xml.rb', line 18 def content_type charset = @raw.respond_to?(:encoding) ? @raw.encoding.to_s.downcase : "utf-8" "application/xml; charset=#{charset}" end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/httpx/transcoder/xml.rb', line 27 def to_s @raw.to_s end |