Module: Glyr::Result::Text
- Included in:
- AlbumReview, Backdrops, GuitarTabs, ImageUrl, Lyrics, Glyr::Relation, Tag, TagAlbum, TagArtist, TagTitle, TextUrl, Track
- Defined in:
- lib/glyr/results.rb
Instance Method Summary collapse
- #to_s ⇒ Object (also: #to_str)
Instance Method Details
#to_s ⇒ Object Also known as: to_str
143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/glyr/results.rb', line 143 def to_s string = data if string.force_encoding('UTF-8').valid_encoding? string elsif string.force_encoding('ISO-8859-1').valid_encoding? string.encode!('UTF-8') else string.encode!('UTF-8', invalid: :replace, undef: :replace) end string end |