Class: HTTParty::TextEncoder
- Inherits:
-
Object
- Object
- HTTParty::TextEncoder
- Defined in:
- lib/httparty/text_encoder.rb
Instance Attribute Summary collapse
-
#assume_utf16_is_big_endian ⇒ Object
readonly
Returns the value of attribute assume_utf16_is_big_endian.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text, assume_utf16_is_big_endian: true, content_type: nil) ⇒ TextEncoder
constructor
A new instance of TextEncoder.
Constructor Details
#initialize(text, assume_utf16_is_big_endian: true, content_type: nil) ⇒ TextEncoder
Returns a new instance of TextEncoder.
7 8 9 10 11 |
# File 'lib/httparty/text_encoder.rb', line 7 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_endian ⇒ Object (readonly)
Returns the value of attribute assume_utf16_is_big_endian.
5 6 7 |
# File 'lib/httparty/text_encoder.rb', line 5 def assume_utf16_is_big_endian @assume_utf16_is_big_endian end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
5 6 7 |
# File 'lib/httparty/text_encoder.rb', line 5 def content_type @content_type end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'lib/httparty/text_encoder.rb', line 5 def text @text end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/httparty/text_encoder.rb', line 13 def call if can_encode? encoded_text else text end end |