るりまサーチ

最速Rubyリファレンスマニュアル検索!
125件ヒット [1-100件を表示] (0.222秒)

別のキーワード

  1. etc sc_xopen_enh_i18n
  2. rsa n=
  3. rsa n
  4. pop n_mails
  5. pop n_bytes

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

Date#month -> Integer (24302.0)

月を返します (1-12)。

月を返します (1-12)。

Exception#backtrace_locations -> [Thread::Backtrace::Location] (18543.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...on#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。

現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。

//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Date.n...
...000, month, -1).day == 31
raise "#{month} is not long month"
end

def get_exception
return begin
yield
rescue => e
e
end
end

e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `g...
...et_exception'", "test.rb:15:in `<main>'"]
//}

@see Exception#backtrace...

Date#next_month(n = 1) -> Date (15325.0)

n ヶ月後を返します。

...n ヶ月後を返します。

Date#>> も参照してください。

@param n 月数...

Date#prev_month(n = 1) -> Date (15325.0)

n ヶ月前を返します。

...n ヶ月前を返します。

Date#<< も参照してください。

@param n 月数...

Date#mon -> Integer (9102.0)

月を返します (1-12)。

月を返します (1-12)。

絞り込み条件を変える

MatchData#offset(name) -> [Integer, Integer] | [nil, nil] (6226.0)

name という名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返 します。

...
n
ame という名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返
します。

//emlist[例][ruby]{
[ self.begin(name), self.end(name) ]
//}

と同じです。nameの名前付きグループにマッチした部分文字列がなければ
[nil, ni...
...ます。

@param name 名前(シンボルか文字列)

@raise IndexError 正規表現中で定義されていない name を指定した場合に発生します。

//emlist[例][ruby]{
/(?<year>\d{4})年(?<month>\d{1,2})月(?:(?<day>\d{1,2})日)?/ =~ "2021年1月"
p $~.offset('year') # => [0,...
...4]
p $~.offset(:year) # => [0, 4]
p $~.offset('month') # => [5, 6]
p $~.offset(:month) # => [5, 6]
p $~.offset('day') # => [nil, nil]
p $~.offset('century') # => `offset': undefined group name reference: century (IndexError)
//}

@see MatchData#begin, MatchData#end...
...4]
p $~.offset(:year) # => [0, 4]
p $~.offset('month') # => [5, 6]
p $~.offset(:month) # => [5, 6]
p $~.offset('day') # => [nil, nil]
p $~.offset('century') # => `offset': undefined group name reference: century (IndexError)
//}

@see MatchData#begin, MatchData#end, MatchData#offset...

MatchData#byteoffset(name) -> [Integer, Integer] | [nil, nil] (6224.0)

name という名前付きグループに対応する部分文字列のバイト単位のオフセットの 配列 [start, end] を返します。

...
n
ame という名前付きグループに対応する部分文字列のバイト単位のオフセットの
配列 [start, end] を返します。

n
ameの名前付きグループにマッチした部分文字列がなければ
[nil, nil] を返します。

@param name 名前(シンボルか文字...
...列)

@raise IndexError 正規表現中で定義されていない name を指定した場合に発生します。

//emlist[例][ruby]{
/(?<year>\d{4})年(?<month>\d{1,2})月(?:(?<day>\d{1,2})日)?/ =~ "2021年1月"
p $~.byteoffset('year') # => [0, 4]
p $~.byteoffset(:year) # => [0, 4]
p $~....
...byteoffset('month') # => [7, 8]
p $~.byteoffset(:month) # => [7, 8]
p $~.byteoffset('day') # => [nil, nil]
p $~.byteoffset('century') # => `offset': undefined group name reference: century (IndexError)
//}

@see MatchData#offset...

Time#httpdate -> String (6207.0)

2616 で定義されている HTTP-date の rfc1123-date 形式の文字列を 返します。

...2616 で定義されている HTTP-date の rfc1123-date 形式の文字列を
返します。

@return 以下の形式の文字列を返します。
//emlist{
day-of-week, DD month-name CCYY hh:mm:ss GMT
//}
注意: 結果はいつも UTC (GMT) です。

使用例
require 'time'

is...
...o8601_time = '2008-08-31T12:34:56+09:00'
t = Time.iso8601(iso8601_time)
p t.httpdate #=> "Sun, 31 Aug 2008 03:34:56 GMT"...

MatchData#offset(n) -> [Integer, Integer] | [nil, nil] (6151.0)

n 番目の部分文字列のオフセットの配列 [start, end] を返 します。

...
n
番目の部分文字列のオフセットの配列 [start, end] を返
します。

//emlist[例][ruby]{
[ self.begin(n), self.end(n) ]
//}

と同じです。n番目の部分文字列がマッチしていなければ
[nil, nil] を返します。

@param n 部分文字列を指定する数値...
...@raise IndexError 範囲外の n を指定した場合に発生します。

@see MatchData#begin, MatchData#end...
...@raise IndexError 範囲外の n を指定した場合に発生します。

@see MatchData#begin, MatchData#end, MatchData#offset...

MatchData#byteoffset(n) -> [Integer, Integer] | [nil, nil] (6139.0)

n 番目の部分文字列のバイト単位のオフセットの 配列 [start, end] を返します。

...
n
番目の部分文字列のバイト単位のオフセットの
配列 [start, end] を返します。

n
番目の部分文字列がマッチしていなければ [nil, nil] を返します。

@param n 部分文字列を指定する数値

@raise IndexError 範囲外の n を指定した場合...
...に発生します。

@see MatchData#offset...

絞り込み条件を変える

Date#<<(n) -> Date (3246.0)

self より n ヶ月前の日付オブジェクトを返します。 n は数値でなければなりません。

...self より n ヶ月前の日付オブジェクトを返します。
n
は数値でなければなりません。

//emlist[][ruby]{
require 'date'
Date.new(2001,2,3) << 1 #=> #<Date: 2001-01-03 ...>
Date.new(2001,2,3) << -2 #=> #<Date: 2001-04-03 ...>
//}

対応する月に同じ日が存...
...]{
require 'date'
Date.new(2001,3,28) << 1 #=> #<Date: 2001-02-28 ...>
Date.new(2001,3,31) << 1 #=> #<Date: 2001-02-28 ...>
//}

このことは以下のように、もしかすると予期しない振る舞いをするかもしれません。

//emlist[][ruby]{
require 'date'
Date.new(2001,3,31...
...) << 2 #=> #<Date: 2001-01-31 ...>
Date.new(2001,3,31) << 1 << 1 #=> #<Date: 2001-01-28 ...>

Date.new(2001,3,31) << 1 << -1 #=> #<Date: 2001-03-28 ...>
//}

Date#prev_month も参照してください。

@param n 月数...
<< 1 2 > >>