Results for: "remove_const"

Returns the subsequent rescue clause of the rescue node. This method is deprecated in favor of subsequent.

Returns the else clause of the unless node. This method is deprecated in favor of else_clause.

Extensions to build when installing the gem, specifically the paths to extconf.rb-style files used to compile extensions.

These files will be run when the gem is installed, causing the C (or whatever) code to be compiled on the user’s machine.

Usage:

spec.extensions << 'ext/rmagic/extconf.rb'

See Gem::Ext::Builder for information about writing extensions for gems.

Sets extensions to extensions, ensuring it is an array.

No documentation available

Returns extensions.

Setter for extensions val.

Adds to self all elements from each array in other_arrays; returns self:

a = [0, 1]
a.concat(['two', 'three'], [:four, :five], a)
# => [0, 1, "two", "three", :four, :five, 0, 1]

Related: see Methods for Assigning.

When a block and a positive integer-convertible object argument count (0 < count <= self.size) are given, calls the block with each combination of self of size count; returns self:

a = %w[a b c]                                   # => ["a", "b", "c"]
a.combination(2) {|combination| p combination } # => ["a", "b", "c"]

Output:

["a", "b"]
["a", "c"]
["b", "c"]

The order of the yielded combinations is not guaranteed.

When count is zero, calls the block once with a new empty array:

a.combination(0) {|combination| p combination }
[].combination(0) {|combination| p combination }

Output:

[]
[]

When count is negative or larger than self.size and self is non-empty, does not call the block:

a.combination(-1) {|combination| fail 'Cannot happen' } # => ["a", "b", "c"]
a.combination(4)  {|combination| fail 'Cannot happen' } # => ["a", "b", "c"]

With no block given, returns a new Enumerator.

Related: Array#permutation; see also Methods for Iterating.

Returns the conjugate of self, Complex.rect(self.imag, self.real):

Complex.rect(1, 2).conj # => (1-2i)

Returns the conjugate of self, Complex.rect(self.imag, self.real):

Complex.rect(1, 2).conj # => (1-2i)

Returns self.

No documentation available

Concatenates each object in objects to self and returns self:

s = 'foo'
s.concat('bar', 'baz') # => "foobarbaz"
s                      # => "foobarbaz"

For each given object object that is an Integer, the value is considered a codepoint and converted to a character before concatenation:

s = 'foo'
s.concat(32, 'bar', 32, 'baz') # => "foo bar baz"

Related: String#<<, which takes a single argument.

Returns the second in range (0..59):

DateTime.new(2001, 2, 3, 4, 5, 6).sec # => 6

Returns pathname configuration variable using fpathconf().

name should be a constant under Etc which begins with PC_.

The return value is an integer or nil. nil means indefinite limit. (fpathconf() returns -1 but errno is not set.)

require 'etc'
IO.pipe {|r, w|
  p w.pathconf(Etc::PC_PIPE_BUF) #=> 4096
}

Returns an integer whose bits show the options set in self.

The option bits are:

Regexp::IGNORECASE # => 1
Regexp::EXTENDED   # => 2
Regexp::MULTILINE  # => 4

Examples:

/foo/.options    # => 0
/foo/i.options   # => 1
/foo/x.options   # => 2
/foo/m.options   # => 4
/foo/mix.options # => 7

Note that additional bits may be set in the returned integer; these are maintained internally in self, are ignored if passed to Regexp.new, and may be ignored by the caller:

Returns the set of bits corresponding to the options used when creating this regexp (see Regexp::new for details). Note that additional bits may be set in the returned options: these are used internally by the regular expression code. These extra bits are ignored if the options are passed to Regexp::new:

r = /\xa1\xa2/e                 # => /\xa1\xa2/
r.source                        # => "\\xa1\\xa2"
r.options                       # => 16
Regexp.new(r.source, r.options) # => /\xa1\xa2/

Requests a connection to be made on the given remote_sockaddr. Returns 0 if successful, otherwise an exception is raised.

Parameter

Example:

# Pull down Google's web page
require 'socket'
include Socket::Constants
socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
sockaddr = Socket.pack_sockaddr_in( 80, 'www.google.com' )
socket.connect( sockaddr )
socket.write( "GET / HTTP/1.0\r\n\r\n" )
results = socket.read

Unix-based Exceptions

On unix-based systems the following system exceptions may be raised if the call to connect fails:

On unix-based systems if the address family of the calling socket is AF_UNIX the follow exceptions may be raised if the call to connect fails:

Windows Exceptions

On Windows systems the following system exceptions may be raised if the call to connect fails:

See

creates a socket connected to the address of self.

The optional argument opts is options represented by a hash. opts may have following options:

:timeout

specify the timeout in seconds.

If a block is given, it is called with the socket and the value of the block is returned. The socket is returned otherwise.

Addrinfo.tcp("www.ruby-lang.org", 80).connect {|s|
  s.print "GET / HTTP/1.0\r\nHost: www.ruby-lang.org\r\n\r\n"
  puts s.read
}

Connects udpsocket to host:port.

This makes possible to send without destination address.

u1 = UDPSocket.new
u1.bind("127.0.0.1", 4913)
u2 = UDPSocket.new
u2.connect("127.0.0.1", 4913)
u2.send "uuuu", 0
p u1.recvfrom(10) #=> ["uuuu", ["AF_INET", 33230, "localhost", "127.0.0.1"]]
scanner = StringScanner.new('foo')
scanner.string           # => "foo"
scanner.terminate
scanner.concat('barbaz') # => #<StringScanner 3/9 "foo" @ "barba...">
scanner.string           # => "foobarbaz"
put_situation(scanner)
# Situation:
#   pos:       3
#   charpos:   3
#   rest:      "barbaz"
#   rest_size: 6

Returns system configuration directory.

This is typically "/etc", but is modified by the prefix used when Ruby was compiled. For example, if Ruby is built and installed in /usr/local, returns "/usr/local/etc" on other platforms than Windows.

On Windows, this always returns the directory provided by the system.

Returns system configuration variable using sysconf().

name should be a constant under Etc which begins with SC_.

The return value is an integer or nil. nil means indefinite limit. (sysconf() returns -1 but errno is not set.)

Etc.sysconf(Etc::SC_ARG_MAX) #=> 2097152
Etc.sysconf(Etc::SC_LOGIN_NAME_MAX) #=> 256

Encodes string using String.encode.

Sets or gets information about the current GC config.

Configuration parameters are GC implementation-specific and may change without notice.

This method can be called without parameters to retrieve the current config as a Hash with Symbol keys.

This method can also be called with a Hash argument to assign values to valid config keys. Config keys missing from the passed Hash will be left unmodified.

If a key/value pair is passed to this function that does not correspond to a valid config key for the GC implementation being used, no config will be updated, the key will be present in the returned Hash, and its value will be nil. This is to facilitate easy migration between GC implementations.

In both call-seqs, the return value of GC.config will be a Hash containing the most recent full configuration, i.e., all keys and values defined by the specific GC implementation being used. In the case of a config update, the return value will include the new values being updated.

This method is only expected to work on CRuby.

GC Implementation independent values

The GC.config hash can also contain keys that are global and read-only. These keys are not specific to any one GC library implementation and attempting to write to them will raise ArgumentError.

There is currently only one global, read-only key:

implementation

Returns a String containing the name of the currently loaded GC library, if one has been loaded using RUBY_GC_LIBRARY, and “default” in all other cases

GC Implementation specific values

GC libraries are expected to document their own configuration. Valid keys for Ruby’s default GC implementation are:

rgengc_allow_full_mark

Controls whether the GC is allowed to run a full mark (young & old objects).

When true, GC interleaves major and minor collections. This is the default. GC will function as intended.

When false, the GC will never trigger a full marking cycle unless explicitly requested by user code. Instead, only a minor mark will run—only young objects will be marked. When the heap space is exhausted, new pages will be allocated immediately instead of running a full mark.

A flag will be set to notify that a full mark has been requested. This flag is accessible using GC.latest_gc_info(:need_major_by)

The user can trigger a major collection at any time using GC.start(full_mark: true)

When false, Young to Old object promotion is disabled. For performance reasons, it is recommended to warm up an application using Process.warmup before setting this parameter to false.

Search took: 4ms  ·  Total Results: 3316