Creates a new directory in the tar file name
with mode
Returns a string usable in Dir.glob
to match all requirable paths for this spec.
Make directories for index generation
The path where installed executables live
Iterates over keys and objects in a weakly referenced object
Calls the given block once for each key
, value
pair in the database.
Returns self
.
Returns true
if the MKD command may be used to create a new directory within the directory.
Returns the factorization of self
.
See Prime#prime_division
for more details.
Passes each character in str to the given block, or returns an enumerator if no block is given.
"hello".each_char {|c| print c, ' ' }
produces:
h e l l o
Changes the encoding to encoding
and returns self.
Returns true for a string which is encoded correctly.
"\xc2\xa1".force_encoding("UTF-8").valid_encoding? #=> true "\xc2".force_encoding("UTF-8").valid_encoding? #=> false "\x80".force_encoding("UTF-8").valid_encoding? #=> false
Converts a BigDecimal
to a String
of the form “nnnnnn.mmm”. This method is deprecated; use BigDecimal#to_s
(“F”) instead.
require 'bigdecimal/util' d = BigDecimal("3.14") d.to_digits # => "3.14"
Returns true if the given ordinal date is valid, and false if not.
Date.valid_ordinal?(2001,34) #=> true Date.valid_ordinal?(2001,366) #=> false
Calls the given block once for each character in ios, passing the character 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.
f = File.new("testfile") f.each_char {|c| print c, ' ' } #=> #<File:testfile>
Returns the Encoding
object that represents the encoding of the file. If io is in write mode and no encoding is specified, returns nil
.
Returns the Encoding
of the internal string if conversion is specified. Otherwise returns nil
.
If single argument is specified, read string from io is tagged with the encoding specified. If encoding is a colon separated two encoding names “A:B”, the read string is converted from encoding A (external encoding) to encoding B (internal encoding), then tagged with B. If two arguments are specified, those must be encoding objects or encoding names, and the first one is the external encoding, and the second one is the internal encoding. If the external encoding and the internal encoding is specified, optional hash argument specify the conversion option.
Returns false if rxp is applicable to a string with any ASCII compatible encoding. Returns true otherwise.
r = /a/ r.fixed_encoding? #=> false r =~ "\u{6666} a" #=> 2 r =~ "\xa1\xa2 a".force_encoding("euc-jp") #=> 2 r =~ "abc".force_encoding("euc-jp") #=> 0 r = /a/u r.fixed_encoding? #=> true r.encoding #=> #<Encoding:UTF-8> r =~ "\u{6666} a" #=> 2 r =~ "\xa1\xa2".force_encoding("euc-jp") #=> Encoding::CompatibilityError r =~ "abc".force_encoding("euc-jp") #=> 0 r = /\u{6666}/ r.fixed_encoding? #=> true r.encoding #=> #<Encoding:UTF-8> r =~ "\u{6666} a" #=> 0 r =~ "\xa1\xa2".force_encoding("euc-jp") #=> Encoding::CompatibilityError r =~ "abc".force_encoding("euc-jp") #=> nil
Iterates over the children of the directory (files and subdirectories, not recursive).
It yields Pathname
object for each child.
By default, the yielded pathnames will have enough information to access the files.
If you set with_directory
to false
, then the returned pathnames will contain the filename only.
Pathname("/usr/local").each_child {|f| p f } #=> #<Pathname:/usr/local/share> # #<Pathname:/usr/local/bin> # #<Pathname:/usr/local/games> # #<Pathname:/usr/local/lib> # #<Pathname:/usr/local/include> # #<Pathname:/usr/local/sbin> # #<Pathname:/usr/local/src> # #<Pathname:/usr/local/man> Pathname("/usr/local").each_child(false) {|f| p f } #=> #<Pathname:share> # #<Pathname:bin> # #<Pathname:games> # #<Pathname:lib> # #<Pathname:include> # #<Pathname:sbin> # #<Pathname:src> # #<Pathname:man>
Note that the results never contain the entries .
and ..
in the directory because they are not children.
Returns the Encoding
object that represents the encoding of the file. If strio is write mode and no encoding is specified, returns nil
.