Class: HTTPX::Plugins::XML::Transcoder::Encoder
- Inherits:
-
Object
- Object
- HTTPX::Plugins::XML::Transcoder::Encoder
- Defined in:
- lib/httpx/plugins/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.
16 17 18 |
# File 'lib/httpx/plugins/xml.rb', line 16 def initialize(xml) @raw = xml end |
Instance Method Details
#bytesize ⇒ Object
25 26 27 |
# File 'lib/httpx/plugins/xml.rb', line 25 def bytesize @raw.to_s.bytesize end |
#content_type ⇒ Object
20 21 22 23 |
# File 'lib/httpx/plugins/xml.rb', line 20 def content_type charset = @raw.respond_to?(:encoding) && @raw.encoding ? @raw.encoding.to_s.downcase : "utf-8" "application/xml; charset=#{charset}" end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/httpx/plugins/xml.rb', line 29 def to_s @raw.to_s end |