Results for: "minmax"

The default directory for binaries

No documentation available

Set the default ACL to acl.

See DRb::DRbServer.default_acl.

Set the default ACL to acl.

See DRb::DRbServer.default_acl.

Creates hard links; returns nil.

Arguments src and dest should be interpretable as paths.

If src is the path to a file and dest does not exist, creates a hard link at dest pointing to src:

FileUtils.touch('src0.txt')
File.exist?('dest0.txt') # => false
FileUtils.link_entry('src0.txt', 'dest0.txt')
File.file?('dest0.txt')  # => true

If src is the path to a directory and dest does not exist, recursively creates hard links at dest pointing to paths in src:

FileUtils.mkdir_p(['src1/dir0', 'src1/dir1'])
src_file_paths = [
  'src1/dir0/t0.txt',
  'src1/dir0/t1.txt',
  'src1/dir1/t2.txt',
  'src1/dir1/t3.txt',
  ]
FileUtils.touch(src_file_paths)
File.directory?('dest1')        # => true
FileUtils.link_entry('src1', 'dest1')
File.file?('dest1/dir0/t0.txt') # => true
File.file?('dest1/dir0/t1.txt') # => true
File.file?('dest1/dir1/t2.txt') # => true
File.file?('dest1/dir1/t3.txt') # => true

Keyword arguments:

Raises an exception if dest is the path to an existing file or directory and keyword argument remove_destination: true is not given.

Related: FileUtils.ln (has different options).

Creates hard links; returns nil.

Arguments src and dest should be interpretable as paths.

If src is the path to a file and dest does not exist, creates a hard link at dest pointing to src:

FileUtils.touch('src0.txt')
File.exist?('dest0.txt') # => false
FileUtils.link_entry('src0.txt', 'dest0.txt')
File.file?('dest0.txt')  # => true

If src is the path to a directory and dest does not exist, recursively creates hard links at dest pointing to paths in src:

FileUtils.mkdir_p(['src1/dir0', 'src1/dir1'])
src_file_paths = [
  'src1/dir0/t0.txt',
  'src1/dir0/t1.txt',
  'src1/dir1/t2.txt',
  'src1/dir1/t3.txt',
  ]
FileUtils.touch(src_file_paths)
File.directory?('dest1')        # => true
FileUtils.link_entry('src1', 'dest1')
File.file?('dest1/dir0/t0.txt') # => true
File.file?('dest1/dir0/t1.txt') # => true
File.file?('dest1/dir1/t2.txt') # => true
File.file?('dest1/dir1/t3.txt') # => true

Keyword arguments:

Raises an exception if dest is the path to an existing file or directory and keyword argument remove_destination: true is not given.

Related: FileUtils.ln (has different options).

No documentation available
No documentation available

Takes a hash as its argument. The key is a symbol or an array of symbols. These symbols correspond to method names, instance variable names, or constant names (see def_delegator). The value is the accessor to which the methods will be delegated.

Takes a hash as its argument. The key is a symbol or an array of symbols. These symbols correspond to method names. The value is the accessor to which the methods will be delegated.

Returns whether or not macro is defined either in the common header files or within any headers you provide.

Any options you pass to opt are passed along to the compiler.

Returns whether or not the entry point func can be found within the library lib in one of the paths specified, where paths is an array of strings. If func is nil , then the main() function is used as the entry point.

If lib is found, then the path it was found on is added to the list of library paths searched and linked against.

Instructs mkmf to search for the given header in any of the paths provided, and returns whether or not it was found in those paths.

If the header is found then the path it was found on is added to the list of included directories that are sent to the compiler (via the -I switch).

Returns where the static type type is defined.

You may also pass additional flags to opt which are then passed along to the compiler.

See also have_type.

Returns the convertible integer type of the given type. You may optionally specify additional headers to search in for the type. convertible means actually the same type, or typedef’d from the same type.

If the type is an integer type and the convertible type is found, the following macros are passed as preprocessor constants to the compiler using the type name, in uppercase.

For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return “unsigned long”, and define these macros:

#define TYPEOF_FOOBAR_T unsigned long
#define FOOBART2NUM ULONG2NUM
#define NUM2FOOBART NUM2ULONG

Searches for the executable bin on path. The default path is your PATH environment variable. If that isn’t defined, it will resort to searching /usr/local/bin, /usr/ucb, /usr/bin and /bin.

If found, it will return the full path, including the executable name, of where it was found.

Note that this method does not actually affect the generated Makefile.

Creates a stub Makefile.

Generates the Makefile for your extension, passing along any options and preprocessor constants that you may have generated through other methods.

The target name should correspond the name of the global function name defined within your C extension, minus the Init_. For example, if your C extension is defined as Init_foo, then your target would simply be “foo”.

If any “/” characters are present in the target name, only the last name is interpreted as the target name, and the rest are considered toplevel directory names, and the generated Makefile will be altered accordingly to follow that directory structure.

For example, if you pass “test/foo” as a target name, your extension will be installed under the “test” directory. This means that in order to load the file within a Ruby program later, that directory structure will have to be followed, e.g. require 'test/foo'.

The srcprefix should be used when your source files are not in the same directory as your build script. This will not only eliminate the need for you to manually copy the source files into the same directory as your build script, but it also sets the proper target_prefix in the generated Makefile.

Setting the target_prefix will, in turn, install the generated binary in a directory under your RbConfig::CONFIG['sitearchdir'] that mimics your local filesystem when you run make install.

For example, given the following file tree:

ext/
  extconf.rb
  test/
    foo.c

And given the following code:

create_makefile('test/foo', 'test')

That will set the target_prefix in the generated Makefile to “test”. That, in turn, will create the following file tree when installed via the make install command:

/path/to/ruby/sitearchdir/test/foo.so

It is recommended that you use this approach to generate your makefiles, instead of copying files around manually, because some third party libraries may depend on the target_prefix being set properly.

The srcprefix argument can be used to override the default source directory, i.e. the current directory. It is included as part of the VPATH and added to the list of INCFLAGS.

No documentation available

Basically a wrapper for Process.spawn that:

The method does not wait for child processes to exit, so the caller must do so.

With no block given, returns a 3-element array containing:

Example:

first_stdin, last_stdout, wait_threads = Open3.pipeline_rw('sort', 'cat -n')
# => [#<IO:fd 20>, #<IO:fd 21>, [#<Process::Waiter:0x000055e8de29ab40 sleep>, #<Process::Waiter:0x000055e8de29a690 sleep>]]
first_stdin.puts("foo\nbar\nbaz")
first_stdin.close # Send EOF to sort.
puts last_stdout.read
wait_threads.each do |wait_thread|
  wait_thread.join
end

Output:

1 bar
2 baz
3 foo

With a block given, calls the block with the stdin stream of the first child, the stdout stream of the last child, and an array of the wait processes:

Open3.pipeline_rw('sort', 'cat -n') do |first_stdin, last_stdout, wait_threads|
  first_stdin.puts "foo\nbar\nbaz"
  first_stdin.close # send EOF to sort.
  puts last_stdout.read
  wait_threads.each do |wait_thread|
    wait_thread.join
  end
end

Output:

1 bar
2 baz
3 foo

Like Process.spawn, this method has potential security vulnerabilities if called with untrusted input; see Command Injection.

If the first argument is a hash, it becomes leading argument env in each call to Process.spawn; see Execution Environment.

If the last argument is a hash, it becomes trailing argument options in each call to Process.spawn; see Execution Options.

Each remaining argument in cmds is one of:

See Argument command_line or exe_path.

Basically a wrapper for Process.spawn that:

The method does not wait for child processes to exit, so the caller must do so.

With no block given, returns a 3-element array containing:

Example:

first_stdin, last_stdout, wait_threads = Open3.pipeline_rw('sort', 'cat -n')
# => [#<IO:fd 20>, #<IO:fd 21>, [#<Process::Waiter:0x000055e8de29ab40 sleep>, #<Process::Waiter:0x000055e8de29a690 sleep>]]
first_stdin.puts("foo\nbar\nbaz")
first_stdin.close # Send EOF to sort.
puts last_stdout.read
wait_threads.each do |wait_thread|
  wait_thread.join
end

Output:

1 bar
2 baz
3 foo

With a block given, calls the block with the stdin stream of the first child, the stdout stream of the last child, and an array of the wait processes:

Open3.pipeline_rw('sort', 'cat -n') do |first_stdin, last_stdout, wait_threads|
  first_stdin.puts "foo\nbar\nbaz"
  first_stdin.close # send EOF to sort.
  puts last_stdout.read
  wait_threads.each do |wait_thread|
    wait_thread.join
  end
end

Output:

1 bar
2 baz
3 foo

Like Process.spawn, this method has potential security vulnerabilities if called with untrusted input; see Command Injection.

If the first argument is a hash, it becomes leading argument env in each call to Process.spawn; see Execution Environment.

If the last argument is a hash, it becomes trailing argument options in each call to Process.spawn; see Execution Options.

Each remaining argument in cmds is one of:

See Argument command_line or exe_path.

Basically a wrapper for Process.spawn that:

With no block given, returns an array of the wait threads for all of the child processes.

Example:

wait_threads = Open3.pipeline_start('ls', 'grep R')
# => [#<Process::Waiter:0x000055e8de9d2bb0 run>, #<Process::Waiter:0x000055e8de9d2890 run>]
wait_threads.each do |wait_thread|
  wait_thread.join
end

Output:

Rakefile
README.md

With a block given, calls the block with an array of the wait processes:

Open3.pipeline_start('ls', 'grep R') do |wait_threads|
  wait_threads.each do |wait_thread|
    wait_thread.join
  end
end

Output:

Rakefile
README.md

Like Process.spawn, this method has potential security vulnerabilities if called with untrusted input; see Command Injection.

If the first argument is a hash, it becomes leading argument env in each call to Process.spawn; see Execution Environment.

If the last argument is a hash, it becomes trailing argument options in each call to Process.spawn; see Execution Options.

Each remaining argument in cmds is one of:

See Argument command_line or exe_path.

Basically a wrapper for Process.spawn that:

With no block given, returns an array of the wait threads for all of the child processes.

Example:

wait_threads = Open3.pipeline_start('ls', 'grep R')
# => [#<Process::Waiter:0x000055e8de9d2bb0 run>, #<Process::Waiter:0x000055e8de9d2890 run>]
wait_threads.each do |wait_thread|
  wait_thread.join
end

Output:

Rakefile
README.md

With a block given, calls the block with an array of the wait processes:

Open3.pipeline_start('ls', 'grep R') do |wait_threads|
  wait_threads.each do |wait_thread|
    wait_thread.join
  end
end

Output:

Rakefile
README.md

Like Process.spawn, this method has potential security vulnerabilities if called with untrusted input; see Command Injection.

If the first argument is a hash, it becomes leading argument env in each call to Process.spawn; see Execution Environment.

If the last argument is a hash, it becomes trailing argument options in each call to Process.spawn; see Execution Options.

Each remaining argument in cmds is one of:

See Argument command_line or exe_path.

No documentation available
No documentation available
Search took: 6ms  ·  Total Results: 2220