Class: HTTParty::TextEncoder

Inherits:
Object
  • Object
show all
Defined in:
lib/httparty/text_encoder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, assume_utf16_is_big_endian: true, content_type: nil) ⇒ TextEncoder

Returns a new instance of TextEncoder


5
6
7
8
9
# File 'lib/httparty/text_encoder.rb', line 5

def initialize(text, assume_utf16_is_big_endian: true, content_type: nil)
  @text = text.dup
  @content_type = content_type
  @assume_utf16_is_big_endian = assume_utf16_is_big_endian
end

Instance Attribute Details

#assume_utf16_is_big_endianObject (readonly)

Returns the value of attribute assume_utf16_is_big_endian


3
4
5
# File 'lib/httparty/text_encoder.rb', line 3

def assume_utf16_is_big_endian
  @assume_utf16_is_big_endian
end

#content_typeObject (readonly)

Returns the value of attribute content_type


3
4
5
# File 'lib/httparty/text_encoder.rb', line 3

def content_type
  @content_type
end

#textObject (readonly)

Returns the value of attribute text


3
4
5
# File 'lib/httparty/text_encoder.rb', line 3

def text
  @text
end

Instance Method Details

#callObject


11
12
13
14
15
16
17
# File 'lib/httparty/text_encoder.rb', line 11

def call
  if can_encode?
    encoded_text
  else
    text
  end
end