Returns true
if the contents of files a
and b
are identical, false
otherwise.
Arguments a
and b
should be interpretable as a path.
FileUtils.identical?
and FileUtils.cmp
are aliases for FileUtils.compare_file
.
Related: FileUtils.compare_stream
.
Returns true
if the contents of files a
and b
are identical, false
otherwise.
Arguments a
and b
should be interpretable as a path.
FileUtils.identical?
and FileUtils.cmp
are aliases for FileUtils.compare_file
.
Related: FileUtils.compare_stream
.
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
.
Returns a parse result whose value is an array of tokens that closely resembles the return value of Ripper::lex
. The main difference is that the ‘:on_sp` token is not emitted.
For supported options, see Prism::parse
.
This lexes with the Ripper
lex. It drops any space events but otherwise returns the same tokens. Raises SyntaxError
if the syntax in source is invalid.
Mirror the Prism.parse_file
API by using the serialization API. This uses native strings instead of Ruby strings because it allows us to use mmap when it is available.
Mirror the Prism.parse_lex
API by using the serialization API.
SyntaxSuggest.handle_error
[Public]
Takes a ‘SyntaxError` exception, uses the error message to locate the file. Then the file will be analyzed to find the location of the syntax error and emit that location to stderr.
Example:
begin require 'bad_file' rescue => e SyntaxSuggest.handle_error(e) end
By default it will re-raise the exception unless ‘re_raise: false`. The message output location can be configured using the `io: $stderr` input.
If a valid filename cannot be determined, the original exception will be re-raised (even with ‘re_raise: false`).
alias foo bar ^^^^^^^^^^^^^
__FILE__ ^^^^^^^^
Visit the list of statements of a statements node. We support nil statements in the list. This would normally not be allowed by the structure of the prism parse tree, but we manually add them here so that we can mirror Ripper’s void stmt.
Defines the callback of event. If you want modify argument in callback, you could use this method instead of WIN32OLE::Event#on_event
.
ie = WIN32OLE.new('InternetExplorer.Application') ev = WIN32OLE::Event.new(ie) ev.on_event_with_outargs('BeforeNavigate2') {|*args| args.last[6] = true }