Module: GObjectIntrospection::TypeTag::IntegerTypeTag

Defined in:
lib/gobject-introspection/type-tag.rb

Instance Method Summary collapse

Instance Method Details

#try_convert(type_info, value) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/gobject-introspection/type-tag.rb', line 41

def try_convert(type_info, value)
  if value.is_a?(Integer)
    value
  elsif value.respond_to?(:to_int)
    value.to_int
  else
    nil
  end
end