Method: Vips::Yard.generate

Defined in:
lib/vips/image.rb

.generateObject



1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
# File 'lib/vips/image.rb', line 1771

def self.generate
  alias_gtypes = {}
  ALIAS.each do |name|
    gtype = Vips.type_find "VipsOperation", name
    alias_gtypes[gtype] = name
  end

  generate_class = lambda do |gtype, _|
    name = if alias_gtypes.key? gtype
      alias_gtypes[gtype]
    else
      Vips.nickname_find gtype
    end

    if name
      begin
        # can fail for abstract types
        introspect = Vips::Introspect.get_yard name
      rescue Vips::Error
        nil
      end

      generate_operation(introspect) if introspect
    end

    Vips.vips_type_map gtype, generate_class, nil
  end

  puts "module Vips"
  puts "  class Image"
  puts ""

  generate_class.call(GObject.g_type_from_name("VipsOperation"), nil)

  puts "  end"
  puts "end"
end