/usr/share/doc/ruby-inline/examples/example2.rb is in ruby-inline 3.12.4-1.
This file is owned by root:root, with mode 0o755.
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 | #!/usr/local/bin/ruby17 -w
begin
require 'rubygems'
rescue LoadError
$: << 'lib'
end
require 'inline'
class MyTest
inline do |builder|
builder.add_compile_flags %q(-x c++)
builder.add_link_flags %q(-lstdc++)
builder.include "<iostream>"
builder.c "
static
void
hello(int i) {
while (i-- > 0) {
std::cout << \"hello\" << std::endl;
}
}
"
end
end
t = MyTest.new()
t.hello(3)
|