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.
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_endian ⇒ Object (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_type ⇒ Object (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 |
#text ⇒ Object (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
#call ⇒ Object
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 |