Class: GLib::VariantType

Inherits:
Object
  • Object
show all
Defined in:
lib/glib2/variant-type.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.try_convert(value) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/glib2/variant-type.rb', line 20

def try_convert(value)
  case value
  when String
    new(value)
  when Symbol
    constant_name = value.to_s.upcase
    if const_defined?(constant_name)
      const_get(constant_name)
    else
      nil
    end
  else
    nil
  end
end

Instance Method Details

#inspectObject



37
38
39
40
41
# File 'lib/glib2/variant-type.rb', line 37

def inspect
  super.gsub(/>\z/) do
    " string=#{self}>"
  end
end