Sha256: ee59d446cbc104f71f33205c6e97685333bbe0d77331a35fc63cd40c7b5edda8

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

# This module provides an interface to the top level bits of libvips
# via ruby-ffi.
#
# Author::    John Cupitt  (mailto:jcupitt@gmail.com)
# License::   MIT

require 'ffi'

module Vips
  if Vips::at_least_libvips?(8, 9)
    attach_function :vips_connection_filename, [:pointer], :string
    attach_function :vips_connection_nick, [:pointer], :string
  end

  # Abstract base class for connections.
  class Connection < Vips::Object
    # The layout of the VipsRegion struct.
    module ConnectionLayout
      def self.included(base)
        base.class_eval do
          layout :parent, Vips::Object::Struct
          # rest opaque
        end
      end
    end

    class Struct < Vips::Object::Struct
      include ConnectionLayout
    end

    class ManagedStruct < Vips::Object::ManagedStruct
      include ConnectionLayout
    end

    # Get any filename associated with a connection, or nil.
    def filename
      Vips::vips_connection_filename self
    end

    # Get a nickname (short description) of a connection that could be shown to
    # the user.
    def nick
      Vips::vips_connection_nick self
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vips-8.11.3 lib/vips/connection.rb
vips-8.10.5 lib/vips/connection.rb
vips-8.9.1 lib/vips/connection.rb
ruby-vips-2.0.17 lib/vips/connection.rb