るりまサーチ

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

別のキーワード

  1. _builtin match
  2. _builtin match?
  3. string match
  4. regexp match
  5. regexp last_match

ライブラリ

クラス

検索結果

MatchData#to_s -> String (21208.0)

マッチした文字列全体を返します。

...マッチした文字列全体を返します。

//emlist[例][ruby]{
/bar/ =~ "foobarbaz"
p $~ # => #<MatchData:0x401b1be4>
p $~.to_s # => "bar"
//}...

Symbol#match(other) -> MatchData | nil (18249.0)

正規表現 other とのマッチを行います。

...(self.to_s.match(other) と同じです。)

@param other 比較対象のシンボルを指定します。

@return マッチが成功すれば MatchData オブジェクトを、そうでなければ nil を返します。

p :foo.match(/foo/) # => #<MatchData "foo">
p :foobar.match(/bar/)...
...# => #<MatchData "bar">
p :foo.match(/bar/) # => nil

@see String#match
@see Symbol#match?...

Symbol#match(other) -> Integer | nil (18143.0)

正規表現 other とのマッチを行います。

...(self.to_s.match(other) と同じです。)

@param other 比較対象のシンボルを指定します。

@return マッチが成功すればマッチした位置を、そうでなければ nil を返します。

p :foo.match(/foo/) # => 0
p :foobar.match(/bar/) # => 3
p :foo.match(/bar/...
...) # => nil

@see String#match...

1.6.8から1.8.0への変更点(まとめ) (750.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への変更点(まとめ)/サポートプラットフォームの追加>))

...fix として 0d が追加されました。
8進リテラルの prefix として 0 以外に 0o が追加されました。

Integer(), String#to_i、String#oct もこの prefix を認識します。

: ((<メソッド引数の & 修飾|メソッド呼び出し/イテレータ>)) [compat]
: ((<...
...yield の戻り値になります。

: to_str [compat]

to_s
tr を定義したオブジェクトはより広範囲にStringとして振舞うように
なりました。

文字列を引数に取るほとんどの組み込みメソッドは、to_str による暗黙の
型変換を試...
...: ((<File/File.extname>)) [new]

追加。ファイル名の拡張子を返します。((<ruby-talk:37617>))

: ((<File/File.fnmatch>)) [new]
: ((<File/File.fnmatch?>)) [new]
追加

このメソッドで使用するフラグ FNM_NOESCAPE, FNM_PATHNAME, FNM_PERIOD,
FNM_CASEFOLD も((...

ruby 1.6 feature (318.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...りました。

p "#{ "" }"

=> ruby 1.6.7 (2002-03-01) [i586-linux]
""

=> -:1: warning: bad substitution in string
ruby 1.6.7 (2002-09-12) [i586-linux]
"#{ }"

=> ruby 1.6.7 (2002-09-25) [i586-linux]
""

これは1.7...
...foo = "foo"
p foo["bar"] = "baz"
p foo

=> ruby 1.6.7 (2002-03-01) [i586-linux]
"baz"
"foo"
=> -:2:in `[]=': string not matched (IndexError)
from -:2
ruby 1.6.7 (2002-07-30) [i586-linux]

: 2002-06-03 sprintf()

"%d" で引数を整数にする...
...まり、名前解
決中にThreadが切替え可能ということです)

require 'resolv'
p Resolv.new.getaddress("www.ruby-lang.org").to_s

=> /usr/local/lib/ruby/1.6/resolv.rb:160: warning: timeout (...) interpreted as method call
/usr/local/lib/ruby/1.6/resolv.rb:55: warni...

絞り込み条件を変える

NEWS for Ruby 3.0.0 (270.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...entError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166

//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}

pr.call(...
...t{
# version 3.0
0 in 1 #=> false

# version 2.7
0 in 1 #=> raise NoMatchingPatternError
//}

* Find-pattern is added. [EXPERIMENTAL]
16828

//emlist{
case ["a", 1, "b", "c", 2, "d", "e", "f", 3]
in [*pre, String => x, String => y, *post]
p pre #=> ["a", 1]
p x #=> "b"
p y #=> "c...
...performance, and usability.

//emlist[][ruby]{
# test.rb
def foo(x)
if x > 10
x.to_s
else
nil
end
end

foo(42)
//}

//emlist{
$ typeprof test.rb
# Classes
class Object
def foo : (Integer) -> String?
end
//}

== Miscellaneous changes

* Methods using `ruby2_keywords` will no longer...

irb (66.0)

irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。

...な記法は以下の通りです。

: %N
起動しているコマンド名(IRB::Context#irb_name)
: %m
main オブジェクト (self) を to_s した文字列
: %M
main オブジェクト (self) を inspect した文字列
: %l
文字列中のタイプを表す (", ', /, ], `]'は%...
...れます。

: help(*names)
: irb_help(*names)

RI から Ruby のドキュメントを参照します。

//emlist{
irb(main):001:0> help String#match
...
//}

names を指定しなかった場合は、RI を対話的なモードで起動します。メソッ
ド名などを入力する...
...ete.
Enter a blank line to exit.

>> String#match
String
#match

(from ruby core)
------------------------------------------------------------------------------
str.match(pattern) -> matchdata or nil
str.match(pattern, pos) -> matchdata or nil
...
//}


=== システム...