Results for: "Data"

Raised when removing a gem with the uninstall command fails

Used to raise parsing and loading errors

No documentation available

Potentially raised when a specification is validated.

No documentation available

Raised when a gem dependencies file specifies a ruby version that does not match the current version.

Raised by Gem::Validator when something is not right in a gem.

Raised by Gem::WebauthnListener when an error occurs during security device verification.

Raised by Resolver when a dependency requests a gem for which there is no spec.

The installer installs the files contained in the .gem into the Gem.home.

Gem::Installer does the work of putting files in all the right places on the filesystem including unpacking the gem into its gem dir, installing the gemspec in the specifications dir, storing the cached gem in the cache dir, and installing either wrappers or symlinks for executables.

The installer invokes pre and post install hooks. Hooks can be added either through a rubygems_plugin.rb file in an installed gem or via a rubygems/defaults/#{RUBY_ENGINE}.rb or rubygems/defaults/operating_system.rb file. See Gem.pre_install and Gem.post_install for details.

Create a package based upon a Gem::Specification. Gem packages, as well as zip files and tar/gzipped packages can be produced by this task.

In addition to the Rake targets generated by Rake::PackageTask, a Gem::PackageTask will also generate the following tasks:

package_dir/name-version.gem”

Create a RubyGems package with the given name and version.

Example using a Gem::Specification:

require 'rubygems'
require 'rubygems/package_task'

spec = Gem::Specification.new do |s|
  s.summary = "Ruby based make-like utility."
  s.name = 'rake'
  s.version = PKG_VERSION
  s.requirements << 'none'
  s.files = PKG_FILES
  s.description = <<-EOF
Rake is a Make-like program implemented in Ruby. Tasks
and dependencies are specified in standard Ruby syntax.
  EOF
end

Gem::PackageTask.new(spec) do |pkg|
  pkg.need_zip = true
  pkg.need_tar = true
end

Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings to the rest of RubyGems.

The Specification class contains the information for a gem. Typically defined in a .gemspec file or a Rakefile, and looks like this:

Gem::Specification.new do |s|
  s.name        = 'example'
  s.version     = '0.1.0'
  s.licenses    = ['MIT']
  s.summary     = "This is an example!"
  s.description = "Much longer explanation of the example!"
  s.authors     = ["Ruby Coder"]
  s.email       = 'rubycoder@example.com'
  s.files       = ["lib/example.rb"]
  s.homepage    = 'https://rubygems.org/gems/example'
  s.metadata    = { "source_code_uri" => "https://github.com/example/example" }
end

Starting in RubyGems 2.0, a Specification can hold arbitrary metadata. See metadata for restrictions on the format and size of metadata items you may add to a specification.

No documentation available
No documentation available

Gem::StubSpecification reads the stub: line from the gemspec. This prevents us having to eval the entire gemspec in order to find out certain information.

An Uninstaller.

The uninstaller fires pre and post uninstall hooks. Hooks can be added either through a rubygems_plugin.rb file in an installed gem or via a rubygems/defaults/#{RUBY_ENGINE}.rb or rubygems/defaults/operating_system.rb file. See Gem.pre_uninstall and Gem.post_uninstall for details.

The UriFormatter handles URIs from user-input and escaping.

uf = Gem::UriFormatter.new 'example.com'

p uf.normalize #=> 'http://example.com'

Explains syntax errors based on their source

example:

source = "def foo; puts 'lol'" # Note missing end
explain ExplainSyntax.new(
  code_lines: CodeLine.from_source(source)
).call
explain.errors.first
# => "Unmatched keyword, missing `end' ?"

When the error cannot be determined by lexical counting then the parser is run against the input and the raw errors are returned.

Example:

source = "1 * " # Note missing a second number
explain ExplainSyntax.new(
  code_lines: CodeLine.from_source(source)
).call
explain.errors.first
# => "syntax error, unexpected end-of-input"

Converts a SyntaxError message to a path

Handles the case where the filename has a colon in it such as on a windows file system: github.com/ruby/syntax_suggest/issues/111

Example:

message = "/tmp/scratch:2:in `require_relative': /private/tmp/bad.rb:1: syntax error, unexpected `end' (SyntaxError)"
puts PathnameFromMessage.new(message).call.name
# => "/tmp/scratch.rb"

LDAP URI SCHEMA (described in RFC2255).

The default port for LDAPS URIs is 636, and the scheme is ‘ldaps:’ rather than ‘ldap:’. Other than that, LDAPS URIs are identical to LDAP URIs; see URI::LDAP.

No documentation available

AbstractSyntaxTree provides methods to parse Ruby code into abstract syntax trees. The nodes in the tree are instances of RubyVM::AbstractSyntaxTree::Node.

This module is MRI specific as it exposes implementation details of the MRI abstract syntax tree.

This module is experimental and its API is not stable, therefore it might change without notice. As examples, the order of children nodes is not guaranteed, the number of children nodes might change, there is no way to access children nodes by name, etc.

If you are looking for a stable API or an API working under multiple Ruby implementations, consider using the parser gem or Ripper. If you would like to make RubyVM::AbstractSyntaxTree stable, please join the discussion at bugs.ruby-lang.org/issues/14844.

Module File::Constants defines file-related constants.

There are two families of constants here:

File constants defined for the local process may be retrieved with method File::Constants.constants:

File::Constants.constants.take(5)
# => [:RDONLY, :WRONLY, :RDWR, :APPEND, :CREAT]

File Access

File-access constants may be used with optional argument mode in calls to the following methods:

Read/Write Access

Read-write access for a stream may be specified by a file-access constant.

The constant may be specified as part of a bitwise OR of other such constants.

Any combination of the constants in this section may be specified.

File::RDONLY

Flag File::RDONLY specifies the stream should be opened for reading only:

filepath = '/tmp/t.tmp'
f = File.new(filepath, File::RDONLY)
f.write('Foo') # Raises IOError (not opened for writing).

File::WRONLY

Flag File::WRONLY specifies that the stream should be opened for writing only:

f = File.new(filepath, File::WRONLY)
f.read # Raises IOError (not opened for reading).

File::RDWR

Flag File::RDWR specifies that the stream should be opened for both reading and writing:

f = File.new(filepath, File::RDWR)
f.write('Foo') # => 3
f.rewind       # => 0
f.read         # => "Foo"

File Positioning

File::APPEND

Flag File::APPEND specifies that the stream should be opened in append mode.

Before each write operation, the position is set to end-of-stream. The modification of the position and the following write operation are performed as a single atomic step.

File::TRUNC

Flag File::TRUNC specifies that the stream should be truncated at its beginning. If the file exists and is successfully opened for writing, it is to be truncated to position zero; its ctime and mtime are updated.

There is no effect on a FIFO special file or a terminal device. The effect on other file types is implementation-defined. The result of using File::TRUNC with File::RDONLY is undefined.

Creating and Preserving

File::CREAT

Flag File::CREAT specifies that the stream should be created if it does not already exist.

If the file exists:

- Raise an exception if File::EXCL is also specified.
- Otherwise, do nothing.

If the file does not exist, then it is created. Upon successful completion, the atime, ctime, and mtime of the file are updated, and the ctime and mtime of the parent directory are updated.

File::EXCL

Flag File::EXCL specifies that the stream should not already exist; If flags File::CREAT and File::EXCL are both specified and the stream already exists, an exception is raised.

The check for the existence and creation of the file is performed as an atomic operation.

If both File::EXCL and File::CREAT are specified and the path names a symbolic link, an exception is raised regardless of the contents of the symbolic link.

If File::EXCL is specified and File::CREAT is not specified, the result is undefined.

POSIX File Constants

Some file-access constants are defined only on POSIX-compliant systems; those are:

File::SYNC, File::RSYNC, and File::DSYNC

Flag File::SYNC, File::RSYNC, or File::DSYNC specifies synchronization of I/O operations with the underlying file system.

These flags are valid only for POSIX-compliant systems.

Note that the behavior of these flags may vary slightly depending on the operating system and filesystem being used. Additionally, using these flags can have an impact on performance due to the synchronous nature of the I/O operations, so they should be used judiciously, especially in performance-critical applications.

File::NOCTTY

Flag File::NOCTTY specifies that if the stream is a terminal device, that device does not become the controlling terminal for the process.

Defined only for POSIX-compliant systems.

File::DIRECT

Flag File::DIRECT requests that cache effects of the I/O to and from the stream be minimized.

Defined only for POSIX-compliant systems.

File::NOATIME

Flag File::NOATIME specifies that act of opening the stream should not modify its access time (atime).

Defined only for POSIX-compliant systems.

File::NOFOLLOW

Flag File::NOFOLLOW specifies that if path is a symbolic link, it should not be followed.

Defined only for POSIX-compliant systems.

File::TMPFILE

Flag File::TMPFILE specifies that the opened stream should be a new temporary file.

Defined only for POSIX-compliant systems.

Other File-Access Constants

File::NONBLOCK

When possible, the file is opened in nonblocking mode. Neither the open operation nor any subsequent I/O operations on the file will cause the calling process to wait.

File::BINARY

Flag File::BINARY specifies that the stream is to be accessed in binary mode.

File::SHARE_DELETE

Flag File::SHARE_DELETE enables other processes to open the stream with delete access.

Windows only.

If the stream is opened for (local) delete access without File::SHARE_DELETE, and another process attempts to open it with delete access, the attempt fails and the stream is not opened for that process.

Locking

Four file constants relate to stream locking; see File#flock:

File::LOCK_EX

Flag File::LOCK_EX specifies an exclusive lock; only one process a a time may lock the stream.

File::LOCK_NB

Flag File::LOCK_NB specifies non-blocking locking for the stream; may be combined with File::LOCK_EX or File::LOCK_SH.

File::LOCK_SH

Flag File::LOCK_SH specifies that multiple processes may lock the stream at the same time.

File::LOCK_UN

Flag File::LOCK_UN specifies that the stream is not to be locked.

Filename Globbing Constants (File::FNM_*)

Filename-globbing constants may be used with optional argument flags in calls to the following methods:

The constants are:

File::FNM_CASEFOLD

Flag File::FNM_CASEFOLD makes patterns case insensitive for File.fnmatch (but not Dir.glob).

File::FNM_DOTMATCH

Flag File::FNM_DOTMATCH makes the '*' pattern match a filename starting with '.'.

File::FNM_EXTGLOB

Flag File::FNM_EXTGLOB enables pattern '{a,b}', which matches pattern ‘a’ and pattern ‘b’; behaves like a regexp union (e.g., '(?:a|b)'):

pattern = '{LEGAL,BSDL}'
Dir.glob(pattern)      # => ["LEGAL", "BSDL"]
Pathname.glob(pattern) # => [#<Pathname:LEGAL>, #<Pathname:BSDL>]
pathname.glob(pattern) # => [#<Pathname:LEGAL>, #<Pathname:BSDL>]

File::FNM_NOESCAPE

Flag File::FNM_NOESCAPE disables '\' escaping.

File::FNM_PATHNAME

Flag File::FNM_PATHNAME specifies that patterns '*' and '?' do not match the directory separator (the value of constant File::SEPARATOR).

File::FNM_SHORTNAME

Flag File::FNM_SHORTNAME allows patterns to match short names if they exist.

Windows only.

File::FNM_SYSCASE

Flag File::FNM_SYSCASE specifies that case sensitivity is the same as in the underlying operating system; effective for File.fnmatch, but not Dir.glob.

Other Constants

File::NULL

Flag File::NULL contains the string value of the null device:

Search took: 8ms  ·  Total Results: 2131