class Vips::Object
Public Class Methods
print_all()
click to toggle source
print all active VipsObjects, with their reference counts. Handy for debugging ruby-vips.
# File lib/vips/object.rb, line 174 def self.print_all GC.start Vips::vips_object_print_all end
Public Instance Methods
get(name)
click to toggle source
# File lib/vips/object.rb, line 239 def get name gtype = get_typeof_error name gvalue = GObject::GValue.alloc gvalue.init gtype GObject::g_object_get_property self, name, gvalue result = gvalue.get gvalue.unset GLib::logger.debug("Vips::Object.get") { "#{name} == #{result}" } return result end
get_pspec(name)
click to toggle source
return a pspec, or nil … nil wil leave a message in the error log which you must clear
# File lib/vips/object.rb, line 208 def get_pspec name ppspec = GObject::GParamSpecPtr.new argument_class = Vips::ArgumentClassPtr.new argument_instance = Vips::ArgumentInstancePtr.new result = Vips::vips_object_get_argument self, name, ppspec, argument_class, argument_instance return nil if result != 0 ppspec[:value] end
get_typeof(name)
click to toggle source
return a gtype, 0 on not found
# File lib/vips/object.rb, line 229 def get_typeof name pspec = get_pspec name unless pspec Vips::vips_error_clear return 0 end pspec[:value_type] end
get_typeof_error(name)
click to toggle source
return a gtype, raise an error on not found
# File lib/vips/object.rb, line 221 def get_typeof_error name pspec = get_pspec name raise Vips::Error unless pspec pspec[:value_type] end
set(name, value)
click to toggle source
# File lib/vips/object.rb, line 252 def set name, value GLib::logger.debug("Vips::Object.set") { "#{name} = #{value}" } gtype = get_typeof_error name gvalue = GObject::GValue.alloc gvalue.init gtype gvalue.set value GObject::g_object_set_property self, name, gvalue gvalue.unset end
signal_connect(name, handler=nil, &block)
click to toggle source
# File lib/vips/object.rb, line 263 def signal_connect name, handler=nil, &block marshal = MARSHAL_ALL[name.to_sym] raise Vips::Error, "unsupported signal #{name}" if marshal.nil? if block_given? # our block as a Proc prc = block elsif handler # We assume the hander is a Proc (perhaps we should test) prc = handler else raise Vips::Error, "must supply either block or handler" end # The marshal function will make a closure with the right type signature # for the selected signal callback = marshal.(prc) # we need to make sure this is not GCd while self is alive @references << callback GObject::g_signal_connect_data(self, name.to_s, callback, nil, nil, 0) end