Sets default internal encoding or removes default internal encoding when passed nil. You should not set Encoding::default_internal
in ruby code as strings created before changing the value may have a different encoding from strings created after the change. Instead you should use ruby -E
to invoke ruby with the correct default_internal.
See Encoding::default_internal
for information on how the default internal encoding is used.
Returns the locale charmap name. It returns nil if no appropriate information.
Debian GNU/Linux LANG=C Encoding.locale_charmap #=> "ANSI_X3.4-1968" LANG=ja_JP.EUC-JP Encoding.locale_charmap #=> "EUC-JP" SunOS 5 LANG=C Encoding.locale_charmap #=> "646" LANG=ja Encoding.locale_charmap #=> "eucJP"
The result is highly platform dependent. So Encoding.find(Encoding.locale_charmap)
may cause an error. If you need some encoding object even for unknown locale, Encoding.find
(“locale”) can be used.
Returns the list of private methods accessible to obj. If the all parameter is set to false
, only those methods in the receiver will be listed.
Returns the list of public methods accessible to obj. If the all parameter is set to false
, only those methods in the receiver will be listed.
Similar to method, searches public method only.
Return a list of the local variable names defined where this NameError
exception was raised.
Internal use only.
The BigDecimal.double_fig
class method returns the number of digits a Float
number is allowed to have. The result depends upon the CPU and OS in use.
Returns true if the given year is a leap year of the proleptic Gregorian calendar.
Date.gregorian_leap?(1900) #=> false Date.gregorian_leap?(2000) #=> true
Deletes all entries for which the code block returns true. Returns self.
Waits until IO
is readable without blocking and returns self
, or nil
when times out. Returns true
immediately when buffered data is available.
Waits until IO
is writable without blocking and returns self
or nil
when times out.
Passes the Integer
ordinal of each character in ios, passing the codepoint as an argument. The stream must be opened for reading or an IOError
will be raised.
If no block is given, an enumerator is returned instead.
Deletes every key-value pair from gdbm for which block evaluates to true.
Iterates over each component of the path.
Pathname.new("/usr/bin/ruby").each_filename {|filename| ... } # yields "usr", "bin", and "ruby".
Returns an Enumerator
if no block was given.
enum = Pathname.new("/usr/bin/ruby").each_filename # ... do stuff ... enum.each { |e| ... } # yields "usr", "bin", and "ruby".
This method is called when the parser found syntax error.
Iterates over the key-value pairs in the database, deleting those for which the block returns true
.
Returns an Addrinfo
object for remote address obtained by getpeername.
Note that addrinfo.protocol is filled by 0.
TCPSocket.open("www.ruby-lang.org", 80) {|s| p s.remote_address #=> #<Addrinfo: 221.186.184.68:80 TCP> } TCPServer.open("127.0.0.1", 1728) {|serv| c = TCPSocket.new("127.0.0.1", 1728) s = serv.accept p s.remote_address #=> #<Addrinfo: 127.0.0.1:36504 TCP> }
Invokes Release method of Dispatch interface of WIN32OLE
object. You should not use this method because this method exists only for debugging WIN32OLE
. The return value is reference counter of OLE object.
invokes Release method of Dispatch interface of WIN32OLE
object. Usually, you do not need to call this method because Release method called automatically when WIN32OLE
object garbaged.