Results for: "uri"

Returns the index of the last occurrence of the given substring or pattern (regexp) in str. Returns nil if not found. If the second parameter is present, it specifies the position in the string to end the search—characters beyond this point will not be considered.

"hello".rindex('e')             #=> 1
"hello".rindex('l')             #=> 3
"hello".rindex('a')             #=> nil
"hello".rindex(?e)              #=> 1
"hello".rindex(/[aeiou]/, -2)   #=> 1

Returns a copy of str with leading and trailing whitespace removed.

Whitespace is defined as any of the following characters: null, horizontal tab, line feed, vertical tab, form feed, carriage return, space.

"    hello    ".strip   #=> "hello"
"\tgoodbye\r\n".strip   #=> "goodbye"
"\x00\t\n\v\f\r ".strip #=> ""

Returns a copy of str with leading whitespace removed. See also String#rstrip and String#strip.

Refer to strip for the definition of whitespace.

"  hello  ".lstrip   #=> "hello  "
"hello".lstrip       #=> "hello"

Returns a copy of str with trailing whitespace removed. See also String#lstrip and String#strip.

Refer to strip for the definition of whitespace.

"  hello  ".rstrip   #=> "  hello"
"hello".rstrip       #=> "hello"

Removes leading and trailing whitespace from str. Returns nil if str was not altered.

Refer to strip for the definition of whitespace.

Removes leading whitespace from str, returning nil if no change was made. See also String#rstrip! and String#strip!.

Refer to strip for the definition of whitespace.

"  hello  ".lstrip!  #=> "hello  "
"hello  ".lstrip!    #=> nil
"hello".lstrip!      #=> nil

Removes trailing whitespace from str, returning nil if no change was made. See also String#lstrip! and String#strip!.

Refer to strip for the definition of whitespace.

"  hello  ".rstrip!  #=> "  hello"
"  hello".rstrip!    #=> nil
"hello".rstrip!      #=> nil

Returns the current fiber. You need to require 'fiber' before using this method. If you are not running in the context of a fiber this method will return the root fiber.

Returns an array containing all of the filenames in the given directory. Will raise a SystemCallError if the named directory doesn’t exist.

The optional enc argument specifies the encoding of the directory. If not specified, the filesystem encoding is used.

Dir.entries("testdir")   #=> [".", "..", "config.h", "main.rb"]

Returns true if the named file is writable by the effective user and group id of this process. See eaccess(3).

With no arguments, sets the default visibility for subsequently defined methods to private. With arguments, sets the named methods to have private visibility. String arguments are converted to symbols.

module Mod
  def a()  end
  def b()  end
  private
  def c()  end
  private :a
end
Mod.private_instance_methods   #=> [:a, :c]

Note that to show a private method on RDoc, use :doc:.

Returns true if the date is Thursday.

Returns true if the date is Friday.

Returns true if the date is Saturday.

Returns the hour (0-23).

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

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 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
p 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.

IO.write("testfile", "0123456789", 20)  #=> 10
# File could contain:  "This is line one\nThi0123456789two\nThis is line three\nAnd so on...\n"
IO.write("testfile", "0123456789")      #=> 10
# File would now read: "0123456789"

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

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.

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

Search took: 8ms  ·  Total Results: 1036