Module: GObjectIntrospection::TypeTag::ArrayTypeTag

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

Instance Method Summary collapse

Instance Method Details

#description(type_info) ⇒ Object



130
131
132
133
# File 'lib/gobject-introspection/type-tag.rb', line 130

def description(type_info)
  element_type_info = type_info.get_param_type(0)
  "#{super}(#{element_type_info.description})"
end

#get_element_type_info(type_info) ⇒ Object



135
136
137
# File 'lib/gobject-introspection/type-tag.rb', line 135

def get_element_type_info(type_info)
  type_info.get_param_type(0)
end

#try_convert(type_info, value) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/gobject-introspection/type-tag.rb', line 117

def try_convert(type_info, value)
  value = Array.try_convert(value)
  return nil if value.nil?
  element_type_info = get_element_type_info(type_info)
  value.collect do |v|
    unless v.nil?
      v = element_type_info.try_convert(v)
      return nil if v.nil?
    end
    v
  end
end