/usr/lib/ruby/vendor_ruby/cairo.rb is in ruby-cairo 1.10.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | # vim: filetype=ruby:expandtab:shiftwidth=2:tabstop=8:softtabstop=2 :
if /mingw|mswin|mswin32/ =~ RUBY_PLATFORM
require 'pathname'
base_dir = Pathname(File.dirname(__FILE__))
base_dir = base_dir.parent + "vendor" + "local"
if base_dir.exist?
base_dir = base_dir.to_s.gsub(/\//, "\\")
ENV['PATH'] = %w(bin lib).collect do |dir|
"#{base_dir}\\#{dir};"
end.join('') + ENV['PATH']
else
require 'rbconfig'
ENV['PATH'] = %w(bin lib).collect do |dir|
"#{Config::CONFIG["prefix"]}\\lib\\GTK\\#{dir};"
end.join('') + ENV['PATH']
end
end
module Cairo
class << self
def __add_one_arg_setter(klass)
names = klass.instance_methods(false)
names.each do |name|
if /^set_(.*)/ =~ name and
not names.include? "#{$1}=" and
klass.instance_method(name).arity == 1
klass.module_eval("def #{$1}=(val); set_#{$1}(val); val; end")
end
end
end
def normalize_const_name(name)
name.to_s.upcase.gsub(/[\s\-_.]+/, "_")
end
end
end
require 'cairo/color'
require 'cairo/paper'
begin
major, minor, micro, = RUBY_VERSION.split(/\./)
require "#{major}.#{minor}/cairo.so"
rescue LoadError
require 'cairo.so'
end
require 'cairo/constants'
module Cairo
class << self
undef __add_one_arg_setter
def bindings_version
major, minor, micro, tag = BINDINGS_VERSION
version = [major, minor, micro].join('.')
version << "-#{tag}" if tag
version
end
def exit_application(exception, status)
puts("#{exception.class}: #{exception}")
puts(exception.backtrace)
exit(status)
end
end
class Surface
def dup
raise NotImplementedError
end
def clone
raise NotImplementedError
end
end
if const_defined?("PSLevel")
module PSLevel
class << self
def names
list.collect {|version| name(version)}
end
end
end
end
if const_defined?("SVGVersion")
module SVGVersion
class << self
def names
list.collect {|version| name(version)}
end
end
end
end
if const_defined?("SVGSurface")
class SVGSurface
class << self
def versions_as_string
SVGVersion.names
end
def versions
SVGVersion.list
end
def version_to_string(version)
SVGVersion.name(version)
end
end
end
end
class Matrix
def dup
Matrix.new(*to_a)
end
def clone
copy = dup
copy.freeze if self.frozen?
copy
end
def translate(tx, ty); dup.translate!(tx, ty); end
def scale(sx, sy); dup.scale!(sx, sy); end
def rotate(radians); dup.rotate!(radians); end
def invert; dup.invert!; end
def multiply(other); dup.multiply!(other); end
alias * multiply
end
class FontOptions
def merge(other)
dup.merge!(other)
end
end
end
require 'cairo/point'
require 'cairo/colors'
require 'cairo/papers'
require 'cairo/context'
require 'cairo/path'
module Cairo
if const_defined?(:Win32Surface)
WIN32Surface = Win32Surface # For backward compatibility
end
end
|