Results for: "uri"

Returns true if the date is Saturday.

No documentation available

Returns true if the date is on or after the day of calendar reform.

Date.new(1582,10,15).gregorian?          #=> true
(Date.new(1582,10,15) - 1).gregorian?    #=> false

This method is equivalent to new_start(Date::GREGORIAN).

Returns the hour (0-23).

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

Returns the hour of the day (0..23) for time.

t = Time.now   #=> 2007-11-19 08:26:20 -0600
t.hour         #=> 8

Returns true if time represents Thursday.

t = Time.local(1995, 12, 21)     #=> 1995-12-21 00:00:00 -0600
t.thursday?                      #=> true

Returns true if time represents Friday.

t = Time.local(1987, 12, 18)     #=> 1987-12-18 00:00:00 -0600
t.friday?                        #=> true

Returns true if time represents Saturday.

t = Time.local(2006, 6, 10)      #=> 2006-06-10 00:00:00 -0500
t.saturday?                      #=> true
No documentation available
No documentation available

Opens the file, optionally seeks to the given offset, writes string, then returns the length written. write ensures the file is closed before returning. If offset is not given in write mode, the file is truncated. Otherwise, it is not truncated.

If name starts with a pipe character ("|") and the receiver is the IO class, a subprocess is created in the same way as Kernel#open, and its output is returned. Consider to use File.write to disable the behavior of subprocess invocation.

File.write("testfile", "0123456789", 20)  #=> 10
# File could contain:  "This is line one\nThi0123456789two\nThis is line three\nAnd so on...\n"
File.write("testfile", "0123456789")      #=> 10
# File would now read: "0123456789"
IO.write("|tr a-z A-Z", "abc")            #=> 3
# Prints "ABC" to the standard output

If the last argument is a hash, it specifies options for the internal open(). It accepts the following keys:

:encoding

string or encoding

Specifies the encoding of the read string. See Encoding.aliases for possible encodings.

:mode

string or integer

Specifies the mode argument for open(). It must start with “w”, “a”, or “r+”, otherwise it will cause an error. See IO.new for the list of possible modes.

:perm

integer

Specifies the perm argument for open().

:open_args

array

Specifies arguments for open() as an array. This key can not be used in combination with other keys.

See also IO.read for details about name and open_args.

Same as IO.write except opening the file in binary mode and ASCII-8BIT encoding ("wb:ASCII-8BIT").

If name starts with a pipe character ("|") and the receiver is the IO class, a subprocess is created in the same way as Kernel#open, and its output is returned. Consider to use File.binwrite to disable the behavior of subprocess invocation.

See also IO.read for details about name and open_args.

Writes the given object(s) to ios. Returns nil.

The stream must be opened for writing. Each given object that isn’t a string will be converted by calling its to_s method. When called without arguments, prints the contents of $_.

If the output field separator ($,) is not nil, it is inserted between objects. If the output record separator ($\) is not nil, it is appended to the output.

$stdout.print("This is ", 100, " percent.\n")

produces:

This is 100 percent.

Formats and writes to ios, converting parameters under control of the format string. See Kernel#sprintf for details.

Writes the given string to ios using a low-level write. Returns the number of bytes written. Do not mix with other methods that write to ios or you may get unpredictable results. Raises SystemCallError on error.

f = File.new("out", "w")
f.syswrite("ABCDEF")   #=> 6

Writes the given string to ios at offset using pwrite() system call. This is advantageous to combining IO#seek and IO#write in that it is atomic, allowing multiple threads/process to share the same IO object for reading the file at various locations. This bypasses any userspace buffering of the IO layer. Returns the number of bytes written. Raises SystemCallError on error and NotImplementedError if platform does not implement the system call.

File.open("out", "w") do |f|
  f.pwrite("ABCDEF", 3)   #=> 6
end

File.read("out")          #=> "\u0000\u0000\u0000ABCDEF"

Writes each of the given objects to self, which must be opened for writing (see Modes); returns the total number bytes written; each of objects that is not a string is converted via method to_s:

$stdout.write('Hello', ', ', 'World!', "\n") # => 14
$stdout.write('foo', :bar, 2, "\n")          # => 8

Output:

Hello, World!
foobar2

Returns an array containing the elements in self, if a finite collection; raises an exception otherwise.

(1..4).to_a     # => [1, 2, 3, 4]
(1...4).to_a    # => [1, 2, 3]
('a'..'d').to_a # => ["a", "b", "c", "d"]

Range#entries is an alias for Range#to_a.

Returns the original string of the pattern.

/ab+c/ix.source #=> "ab+c"

Note that escape sequences are retained as is.

/\x20\+/.source  #=> "\\x20\\+"

Callback invoked whenever a subclass of the current class is created.

Example:

class Foo
  def self.inherited(subclass)
    puts "New subclass: #{subclass}"
  end
end

class Bar < Foo
end

class Baz < Bar
end

produces:

New subclass: Bar
New subclass: Baz

Writes contents to the file.

See File.write.

Writes contents to the file, opening it in binary mode.

See File.binwrite.

See FileTest.writable?.

Return the entries (files and subdirectories) in the directory, each as a Pathname object.

The results contains just the names in the directory, without any trailing slashes or recursive look-up.

pp Pathname.new('/usr/local').entries
#=> [#<Pathname:share>,
#    #<Pathname:lib>,
#    #<Pathname:..>,
#    #<Pathname:include>,
#    #<Pathname:etc>,
#    #<Pathname:bin>,
#    #<Pathname:man>,
#    #<Pathname:games>,
#    #<Pathname:.>,
#    #<Pathname:sbin>,
#    #<Pathname:src>]

The result may contain the current directory #<Pathname:.> and the parent directory #<Pathname:..>.

If you don’t want . and .. and want directories, consider Pathname#children.

Search took: 4ms  ·  Total Results: 857