Class: GObjectIntrospection::TypeTag::FILENAME

Inherits:
Object
  • Object
show all
Defined in:
lib/gobject-introspection/type-tag.rb

Class Method Summary collapse

Class Method Details

.try_convert(type_info, value) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/gobject-introspection/type-tag.rb', line 100

def try_convert(type_info, value)
  case value
  when String
    value.encode(GLib::FILENAME_ENCODING)
  else
    if value.respond_to?(:to_path)
      value.to_path.encode(GLib::FILENAME_ENCODING)
    elsif value.respond_to?(:to_str)
      value.to_str.encode(GLib::FILENAME_ENCODING)
    else
      nil
    end
  end
end