class Pango::CairoLoader - pango-3.2.9 Documentation

# class Pango::CairoLoader

### Private Instance Methods

load_function_info(info) click to toggle source

    # File lib/pango/cairo-loader.rb, line 28
    def load_function_info(info)
      case info.name
      when /\Acontext_get_(.+)\z/
        method_name = $1
        define_method(info, @context_class, method_name)
      when /\Acontext_set_(.+)\z/
        method_base_name = $1
        setter_method_name = "set_#{method_base_name}"
        if @context_class.method_defined?(setter_method_name)
          # ignore
          return
        end
        define_method(info, @context_class, setter_method_name)
        if info.n_args == 2
          equal_method_name = "#{method_base_name}="
          remove_existing_method(@context_class, equal_method_name)
          @context_class.__send__(:alias_method,
                                  equal_method_name,
                                  setter_method_name)
        end
      when /\Afont_map_/
        # ignore
      when /\Acreate_(.+)\z/
        define_method(info, Cairo::Context, "create_pango_#{$1}")
      when /\A(.+_path)\z/
        define_method(info, Cairo::Context, "pango_#{$1}")
      when /\Ashow_(.+)\z/
        define_method(info, Cairo::Context, "show_pango_#{$1}")
      when /\Aupdate_(.+)\z/
        define_method(info, Cairo::Context, "update_pango_#{$1}")
      else
        warn("Unsupported PangoCairo function: #{info.name}")
      end
    end

pre_load(repository, namespace) click to toggle source

    # File lib/pango/cairo-loader.rb, line 20
    def pre_load(repository, namespace)
      @context_class = @base_module.const_get(:Context)
    end

rubyish_class_name(info) click to toggle source

    # File lib/pango/cairo-loader.rb, line 24
    def rubyish_class_name(info)
      "Cairo#{super}"
    end