Class: HTTPX::Plugins::XML::Transcoder::Encoder

Inherits:
Object
  • Object
show all
Defined in:
lib/httpx/plugins/xml.rb

Instance Method Summary collapse

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

#bytesizeObject



25
26
27
# File 'lib/httpx/plugins/xml.rb', line 25

def bytesize
  @raw.to_s.bytesize
end

#content_typeObject



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_sObject



29
30
31
# File 'lib/httpx/plugins/xml.rb', line 29

def to_s
  @raw.to_s
end