This method is defined for backward compatibility.
Scans one byte and returns it. This method is not multibyte character sensitive. See also: getch
.
s = StringScanner.new('ab') s.get_byte # => "a" s.get_byte # => "b" s.get_byte # => nil s = StringScanner.new("\244\242".force_encoding("euc-jp")) s.get_byte # => "\xA4" s.get_byte # => "\xA2" s.get_byte # => nil
Defines the constants of OLE Automation server as mod’s constants. The first argument is WIN32OLE
object or type library name. If 2nd argument is omitted, the default is WIN32OLE
. The first letter of Ruby’s constant variable name is upper case, so constant variable name of WIN32OLE
object is capitalized. For example, the ‘xlTop’ constant of Excel is changed to ‘XlTop’ in WIN32OLE
. If the first letter of constant variable is not [A-Z], then the constant is defined as CONSTANTS hash element.
module EXCEL_CONST end excel = WIN32OLE.new('Excel.Application') WIN32OLE.const_load(excel, EXCEL_CONST) puts EXCEL_CONST::XlTop # => -4160 puts EXCEL_CONST::CONSTANTS['_xlDialogChartSourceData'] # => 541 WIN32OLE.const_load(excel) puts WIN32OLE::XlTop # => -4160 module MSO end WIN32OLE.const_load('Microsoft Office 9.0 Object Library', MSO) puts MSO::MsoLineSingle # => 1
If obj
is a Hash
object, returns obj
.
Otherwise if obj
responds to :to_hash
, calls obj.to_hash
and returns the result.
Returns nil
if obj
does not respond to :to_hash
Raises an exception unless obj.to_hash
returns a Hash
object.
Reads at most maxlen bytes from the ARGF
stream in non-blocking mode.
Returns the external encoding for files read from ARGF
as an Encoding
object. The external encoding is the encoding of the text as stored in a file. Contrast with ARGF.internal_encoding
, which is the encoding used to represent this text within Ruby.
To set the external encoding use ARGF.set_encoding
.
For example:
ARGF.external_encoding #=> #<Encoding:UTF-8>
Returns the internal encoding for strings read from ARGF
as an Encoding
object.
If ARGF.set_encoding
has been called with two encoding names, the second is returned. Otherwise, if Encoding.default_external
has been set, that value is returned. Failing that, if a default external encoding was specified on the command-line, that value is used. If the encoding is unknown, nil
is returned.
Reinitializes delegation from a serialized object.
Creates a new compiler for ERB
. See ERB::Compiler.new for details
Returns true if the ipaddr is a link-local address. IPv4 addresses in 169.254.0.0/16 reserved by RFC 3927 and link-local IPv6 Unicast Addresses in fe80::/10 reserved by RFC 4291 are considered link-local. Link-local IPv4 addresses in the IPv4-mapped IPv6 address range are also considered link-local.
Creates a Range
object for the network address.
Returns the names of the binding’s local variables as symbols.
def foo a = 1 2.times do |n| binding.local_variables #=> [:a, :n] end end
This method is the short version of the following code:
binding.eval("local_variables")
Returns the Ruby source filename and line number of the binding object.
Program name to be emitted in error message and default banner, defaults to $0.
Returns additional info.
Shows version string in packages if Version
is defined.
pkgs
package list
Load the given PStore
file. If read_only
is true, the unmarshalled Hash
will be returned. If read_only
is false, a 3-tuple will be returned: the unmarshalled Hash
, a checksum of the data, and the size of the data.
Returns the Ruby source filename and line number containing this proc or nil
if this proc was not defined in Ruby (i.e. native).
Returns the Ruby source filename and line number containing this method or nil if this method was not defined in Ruby (i.e. native).
Returns a Method
of superclass which would be called when super is used or nil if there is no method on superclass.
Returns the Ruby source filename and line number containing this method or nil if this method was not defined in Ruby (i.e. native).
Returns a Method
of superclass which would be called when super is used or nil if there is no method on superclass.
Closes the incoming port and returns whether it was already closed. All further attempts to Ractor.receive
in the ractor, and send
to the ractor will fail with Ractor::ClosedError
.
r = Ractor.new {sleep(500)} r.close_incoming #=> false r.close_incoming #=> true r.send('test') # Ractor::ClosedError (The incoming-port is already closed)
Closes the outgoing port and returns whether it was already closed. All further attempts to Ractor.yield
in the ractor, and take
from the ractor will fail with Ractor::ClosedError
.
r = Ractor.new {sleep(500)} r.close_outgoing #=> false r.close_outgoing #=> true r.take # Ractor::ClosedError (The outgoing-port is already closed)