module GObjectIntrospection::TypeTag::UTF8

Public Class Methods

try_convert(type_info, value) click to toggle source
# File lib/gobject-introspection/type-tag.rb, line 81
def try_convert(type_info, value)
  case value
  when String
    value.encode(Encoding::UTF_8)
  when Symbol
    value.to_s.encode(Encoding::UTF_8)
  else
    if value.respond_to?(:to_str)
      value.to_str.encode(Encoding::UTF_8)
    else
      nil
    end
  end
end