Module: GObjectIntrospection::TypeTag::FloatTypeTag

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

Instance Method Summary collapse

Instance Method Details

#try_convert(type_info, value) ⇒ Object



62
63
64
65
66
67
68
69
70
# File 'lib/gobject-introspection/type-tag.rb', line 62

def try_convert(type_info, value)
  if value.is_a?(Float)
    value
  elsif value.respond_to?(:to_f) # TODO: Should we stop this?
    value.to_f
  else
    nil
  end
end