Results for: "Data"

Returns true if self is a Wednesday, false otherwise.

Returns true if self is a Thursday, false otherwise.

Returns true if self is a Friday, false otherwise.

Returns the Julian start date for calendar reform; if not an infinity, the returned value is suitable for passing to Date#jd:

d = Date.new(2001, 2, 3, Date::ITALY)
s = d.start     # => 2299161.0
Date.jd(s).to_s # => "1582-10-15"

d = Date.new(2001, 2, 3, Date::ENGLAND)
s = d.start     # => 2361222.0
Date.jd(s).to_s # => "1752-09-14"

Date.new(2001, 2, 3, Date::GREGORIAN).start # => -Infinity
Date.new(2001, 2, 3, Date::JULIAN).start    # => Infinity

See argument start.

Equivalent to Date#new_start with argument Date::ITALY.

Returns the integer day of the month for self, in range (1..31):

t = Time.new(2000, 1, 2, 3, 4, 5, 6)
# => 2000-01-02 03:04:05 +000006
t.mday # => 2

Time#day is an alias for Time#mday.

Related: Time#year, Time#hour, Time#min.

Returns the integer day of the month for self, in range (1..31):

t = Time.new(2000, 1, 2, 3, 4, 5, 6)
# => 2000-01-02 03:04:05 +000006
t.mday # => 2

Time#day is an alias for Time#mday.

Related: Time#year, Time#hour, Time#min.

Returns the integer day of the week for self, in range (0..6), with Sunday as zero.

t = Time.new(2000, 1, 2, 3, 4, 5, 6)
# => 2000-01-02 03:04:05 +000006
t.wday    # => 0
t.sunday? # => true

Related: Time#year, Time#hour, Time#min.

Returns the integer day of the year of self, in range (1..366).

Time.new(2000, 1, 1).yday   # => 1
Time.new(2000, 12, 31).yday # => 366

Returns true if self represents a Sunday, false otherwise:

t = Time.utc(2000, 1, 2) # => 2000-01-02 00:00:00 UTC
t.sunday?                # => true

Related: Time#monday?, Time#tuesday?, Time#wednesday?.

Returns true if self represents a Monday, false otherwise:

t = Time.utc(2000, 1, 3) # => 2000-01-03 00:00:00 UTC
t.monday?                # => true

Related: Time#tuesday?, Time#wednesday?, Time#thursday?.

Returns true if self represents a Tuesday, false otherwise:

t = Time.utc(2000, 1, 4) # => 2000-01-04 00:00:00 UTC
t.tuesday?               # => true

Related: Time#wednesday?, Time#thursday?, Time#friday?.

Returns true if self represents a Wednesday, false otherwise:

t = Time.utc(2000, 1, 5) # => 2000-01-05 00:00:00 UTC
t.wednesday?             # => true

Related: Time#thursday?, Time#friday?, Time#saturday?.

Returns true if self represents a Thursday, false otherwise:

t = Time.utc(2000, 1, 6) # => 2000-01-06 00:00:00 UTC
t.thursday?              # => true

Related: Time#friday?, Time#saturday?, Time#sunday?.

Returns true if self represents a Friday, false otherwise:

t = Time.utc(2000, 1, 7) # => 2000-01-07 00:00:00 UTC
t.friday?                # => true

Related: Time#saturday?, Time#sunday?, Time#monday?.

Returns a new Time object based on the given arguments.

Required argument time may be either of:

Examples:

t = Time.new(2000, 12, 31, 23, 59, 59) # => 2000-12-31 23:59:59 -0600
secs = t.to_i                          # => 978328799
Time.at(secs)                          # => 2000-12-31 23:59:59 -0600
Time.at(secs + 0.5)                    # => 2000-12-31 23:59:59.5 -0600
Time.at(1000000000)                    # => 2001-09-08 20:46:40 -0500
Time.at(0)                             # => 1969-12-31 18:00:00 -0600
Time.at(-1000000000)                   # => 1938-04-24 17:13:20 -0500

Optional numeric argument subsec and optional symbol argument units work together to specify subseconds for the returned time; argument units specifies the units for subsec:

Optional keyword argument +in: zone specifies the timezone for the returned time:

Time.at(secs, in: '+12:00') # => 2001-01-01 17:59:59 +1200
Time.at(secs, in: '-12:00') # => 2000-12-31 17:59:59 -1200

For the forms of argument zone, see Timezone Specifiers.

Returns pathname configuration variable using fpathconf().

name should be a constant under Etc which begins with PC_.

The return value is an integer or nil. nil means indefinite limit. (fpathconf() returns -1 but errno is not set.)

require 'etc'
IO.pipe {|r, w|
  p w.pathconf(Etc::PC_PIPE_BUF) #=> 4096
}

Returns true if the stream is associated with a terminal device (tty), false otherwise:

f = File.new('t.txt').isatty    #=> false
f.close
f = File.new('/dev/tty').isatty #=> true
f.close

IO#tty? is an alias for IO#isatty.

Returns the path associated with the IO, or nil if there is no path associated with the IO. It is not guaranteed that the path exists on the filesystem.

$stdin.path # => "<STDIN>"

File.open("testfile") {|f| f.path} # => "testfile"

With no block given, returns the MatchData object that describes the match, if any, or nil if none; the search begins at the given character offset in string:

/abra/.match('abracadabra')      # => #<MatchData "abra">
/abra/.match('abracadabra', 4)   # => #<MatchData "abra">
/abra/.match('abracadabra', 8)   # => nil
/abra/.match('abracadabra', 800) # => nil

string = "\u{5d0 5d1 5e8 5d0}cadabra"
/abra/.match(string, 7)          #=> #<MatchData "abra">
/abra/.match(string, 8)          #=> nil
/abra/.match(string.b, 8)        #=> #<MatchData "abra">

With a block given, calls the block if and only if a match is found; returns the block’s value:

/abra/.match('abracadabra') {|matchdata| p matchdata }
# => #<MatchData "abra">
/abra/.match('abracadabra', 4) {|matchdata| p matchdata }
# => #<MatchData "abra">
/abra/.match('abracadabra', 8) {|matchdata| p matchdata }
# => nil
/abra/.match('abracadabra', 8) {|marchdata| fail 'Cannot happen' }
# => nil

Output (from the first two blocks above):

#<MatchData "abra">
#<MatchData "abra">

 /(.)(.)(.)/.match("abc")[2] # => "b"
 /(.)(.)/.match("abc", 1)[2] # => "c"

Returns true or false to indicate whether the regexp is matched or not without updating $~ and other related variables. If the second parameter is present, it specifies the position in the string to begin the search.

/R.../.match?("Ruby")    # => true
/R.../.match?("Ruby", 1) # => false
/P.../.match?("Ruby")    # => false
$&                       # => nil

Returns a new set that is a copy of the set, flattening each containing set recursively.

Equivalent to Set#flatten, but replaces the receiver with the result in place. Returns nil if no modifications were made.

Equivalent to self.to_s.match, including possible updates to global variables; see String#match.

Equivalent to sym.to_s.match?; see String#match.

Search took: 5ms  ·  Total Results: 1397