種類
- インスタンスメソッド (81)
- 文書 (42)
ライブラリ
- ビルトイン (81)
クラス
-
Encoding
:: Converter (33) - MatchData (26)
- Regexp (22)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 3
. 1 . 0 (3) - byteoffset (4)
- match (22)
-
primitive
_ convert (33) -
ruby 1
. 9 feature (11)
検索結果
先頭5件
-
MatchData
# offset(name) -> [Integer , Integer] | [nil , nil] (18412.0) -
name という名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返 します。
...部分文字列のオフセットの配列 [start, end] を返
します。
//emlist[例][ruby]{
[ self.begin(name), self.end(name) ]
//}
と同じです。nameの名前付きグループにマッチした部分文字列がなければ
[nil, nil] を返します。
@param name 名前(シンボル......?:(?<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 (I......ndexError)
//}
@see MatchData#begin, MatchData#end......ndexError)
//}
@see MatchData#begin, MatchData#end, MatchData#offset... -
MatchData
# offset(n) -> [Integer , Integer] | [nil , nil] (18367.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(name) -> [Integer , Integer] | [nil , nil] (6360.0) -
name という名前付きグループに対応する部分文字列のバイト単位のオフセットの 配列 [start, end] を返します。
...ループに対応する部分文字列のバイト単位のオフセットの
配列 [start, end] を返します。
nameの名前付きグループにマッチした部分文字列がなければ
[nil, nil] を返します。
@param name 名前(シンボルか文字列)
@raise IndexError 正規......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... -
MatchData
# byteoffset(n) -> [Integer , Integer] | [nil , nil] (6345.0) -
n 番目の部分文字列のバイト単位のオフセットの 配列 [start, end] を返します。
...のオフセットの
配列 [start, end] を返します。
n番目の部分文字列がマッチしていなければ [nil, nil] を返します。
@param n 部分文字列を指定する数値
@raise IndexError 範囲外の n を指定した場合に発生します。
@see MatchData#offset... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (1260.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...りました。
* nil: 警告を出力しない (-W0 新しい警告レベル)
* false: 重要な警告のみ出力 (-W1 デフォルト)
* true: すべての警告を出力する (-W2 or -W or -v or -w or --verbose)
追加された -W オプションは $VERBOSE = nil の指定(-W0)を......よくわかりません(^^;
class << Object
p [self.id, self]
class << self
p [self.id, self]
end
end
=> ruby 1.6.7 (2002-03-01) [i586-linux]
[537771634, Class]
[537742484, Class]
=> ruby 1.7.3 (2002-09......local|Time/getlocal>)) [new]
: ((<Time#getutc|Time/getutc>)) [new]
: ((<Time#gmt_offset|Time/gmt_offset>)) [new]
: ((<Time#gmtoff|Time/gmtoff>)) [new]
: ((<Time#utc_offset|Time/utc_offset>)) [new]
追加
=== その他
: ((<Array#values_at|Array/values_at>)) [new]
: ((<Hash#v... -
Regexp
# match(str , pos = 0) -> MatchData | nil (160.0) -
指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。
...ッ
チングを行います。マッチした場合には結果を MatchData オブジェクトで返し
ます。
マッチしなかった場合 nil を返します。
省略可能な第二引数 pos を指定すると、マッチの開始位置を pos から行
うよう制御できます(pos......)/.match("foobar", 3).captures) # => ["b", "r"]
p(/(.).(.)/.match("foobar", -3).captures) # => ["b", "r"]
//}
pos を指定しても MatchData#offset 等の結果
には影響しません。つまり、
//emlist[][ruby]{
re.match(str[pos..-1])
//}
と
//emlist[][ruby]{
re.match(str, pos)
//}
は......ト値は 0)。
//emlist[例][ruby]{
reg = Regexp.new("foo")
if reg.match("foobar")
puts "match"
end
# => match
p reg.match("foobar") # => #<MatchData:0x29403fc>
p reg.match("bar") # => nil
p /(foo)(bar)(baz)/.match("foobarbaz").to_a.values_at(1,2,3) # => ["foo", "bar", "baz"]
//}
=== 便... -
Regexp
# match(str , pos = 0) {|m| . . . } -> object | nil (160.0) -
指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。
...ッ
チングを行います。マッチした場合には結果を MatchData オブジェクトで返し
ます。
マッチしなかった場合 nil を返します。
省略可能な第二引数 pos を指定すると、マッチの開始位置を pos から行
うよう制御できます(pos......)/.match("foobar", 3).captures) # => ["b", "r"]
p(/(.).(.)/.match("foobar", -3).captures) # => ["b", "r"]
//}
pos を指定しても MatchData#offset 等の結果
には影響しません。つまり、
//emlist[][ruby]{
re.match(str[pos..-1])
//}
と
//emlist[][ruby]{
re.match(str, pos)
//}
は......ト値は 0)。
//emlist[例][ruby]{
reg = Regexp.new("foo")
if reg.match("foobar")
puts "match"
end
# => match
p reg.match("foobar") # => #<MatchData:0x29403fc>
p reg.match("bar") # => nil
p /(foo)(bar)(baz)/.match("foobarbaz").to_a.values_at(1,2,3) # => ["foo", "bar", "baz"]
//}
=== 便... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset) -> Symbol (118.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ram source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定す......%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}
不正なバイトや変換先で未定義なバイトをエスケープしつつ変換する例です。以上のように、戻... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize) -> Symbol (118.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ram source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定す......%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}
不正なバイトや変換先で未定義なバイトをエスケープしつつ変換する例です。以上のように、戻... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (118.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ram source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@param options 変換の詳細を指定す......%s}' % [c.ord, c.encoding])
redo
when :incomplete_input
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
when :finished
end
break
end while nil
//}
不正なバイトや変換先で未定義なバイトをエスケープしつつ変換する例です。以上のように、戻... -
NEWS for Ruby 3
. 1 . 0 (108.0) -
NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ッドに渡されるだけの場合は、ブロックの引数を無名にできるようになりました。 11256
//emlist{
def foo(&)
bar(&)
end
//}
* ピン演算子に式を書けるようになりました。 17411
//emlist{
Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3.......com/ruby/ruby/pull/1509
//emlist[Enumerable#each_cons Enumerable#each_slice][ruby]{
[1, 2, 3].each_cons(2){}
# 3.0 => nil
# 3.1 => [1, 2, 3]
[1, 2, 3].each_slice(2){}
# 3.0 => nil
# 3.1 => [1, 2, 3]
//}
* Enumerator::Lazy
* 新規メソッド
* Enumerator::Lazy#compact が追加さ......ck と String#unpack1 が任意のバイト数をスキップした後にアンパックを開始するための offset: キーワード引数を渡せるようになりました。 offset が文字列の範囲外の場合、 ArgumentError 例外が発生します。 18254
* Thread
* 新規... -
NEWS for Ruby 2
. 5 . 0 (78.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...547
* do/end ブロック内部で rescue/else/ensure を書けるようになりました 12906
* 文字列の式展開内部の暗黙の to_s 呼び出しにも refinements が影響するようになりました 13812
=== 組み込みクラスの更新
* Array
* Array#append を追加......7688
* 数値の比較メソッド(<,<=,>=,>)は、coerceメソッドで発生した例外を隠蔽しなくなりました。
coerceがnilを返す場合、変換は不可能です。7688
* Process
* getrusage(2) が存在する場合 Process.#times の精度を改良しまし......hub.com/ruby/psych/pull/326
* Make frozen string literal = true
https://github.com/ruby/psych/pull/320
* Preserve time zone offset when deserializing times
https://github.com/ruby/psych/pull/316
* Remove deprecated method aliases for syck gem
https://github....