種類
- 文書 (77)
- インスタンスメソッド (60)
ライブラリ
- ビルトイン (60)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - =~ (11)
-
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 3
. 0 . 0 (4) - match (33)
- match? (16)
-
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) - クラス/メソッドの定義 (11)
- 正規表現 (11)
検索結果
-
Regexp
# =~(string) -> Integer | nil (36.0) -
文字列 string との正規表現マッチを行います。マッチした場合、 マッチした位置のインデックスを返します(先頭は0)。マッチしなかった 場合、あるいは string が nil の場合には nil を返 します。
...xp.last_match にマッチに関する情報 MatchData が設定されます。
文字列のかわりにSymbolをマッチさせることができます。
@param string マッチ対象文字列
@raise TypeError string が nil でも String オブジェクト
でも Symbol でも......ist[例][ruby]{
p /foo/ =~ "foo" # => 0
p Regexp.last_match(0) # => "foo"
p /foo/ =~ "afoo" # => 1
p $~[0] # => "foo"
p /foo/ =~ "bar" # => nil
unless /foo/ === "bar"
puts "not match " # => not match
end
str = []
begin
/ugo/ =~ str
rescue TypeError
printf... -
ruby 1
. 9 feature (30.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...rver
削除
=== 2006-06-11
: __callee__ [new]
: __method__ [new]
((<URL:http://www.dm4lab.to/~usa/ruby/d/200606a.html#id20060610_P1_7>))
: Symbol#to_proc
=== 2006-06-10
* 新機能
: BasicObject が導入されました [new]
: local という visibility および Module#local, Module......16833>))
((<URL:http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9+update+4>))
=== 2006-05-22
: accept
((<ruby-core:7917>))
=== 2006-03-21
: MatchData#[] [compat]
名前による参照
((<ruby-dev:28446>))
=== 2006-03-03
: FileUtils.cp_r [lib] [compat]
remove_destination オプシ......=== 2004-07-17
: Regexp#match(str, [pos]) [compat]
: String#match(re, [pos]) [compat]
省略可能な第二引数 pos が追加されました。マッチの開始位置を指定しま
す。((<ruby-core:03203>)), ((<ruby-core:03205>))
p(/(.)/.match("foobar", 4).captures)... -
クラス/メソッドの定義 (30.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...も同じ)
class Foo
def bar
end
end
# 間違ったスーパークラスを指定するとエラー
class Foo < String
end
# => superclass mismatch for class Foo (TypeError)
//}
クラス定義式の中は self がそのクラスであることと、
limitのデフォルトが異なること......e, else, ensure 節を指定できます。
例外処理についてはd:spec/control#begin参照。
メソッド定義式は、メソッド名を Symbol にしたオブジェクトを返します。
@see https://magazine.rubyist.net/articles/0041/0041-200Special-kwarg.html
====[a:operator] 演......指向システムにお
けるクラスメソッドの働きをすることになります。
特異メソッド定義式は、メソッド名を Symbol にしたオブジェクトを返します。
===[a:class_method] クラスメソッドの定義
Ruby におけるクラスメソッドとは... -
NEWS for Ruby 2
. 2 . 0 (12.0) -
NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ました
* String
* 追加: String#unicode_normalize
* 追加: String#unicode_normalize!
* 追加: String#unicode_normalized?
* Symbol
* 改善: String#to_sym, String#intern によって返される多くのシンボルがGC可能になりました
* Method
* 追加: Me......er raised when lambda Proc is passed as a
block, and the number of yielded arguments does not match the formal
arguments of the lambda, if just an array is yielded and its length
matches.
* Process
* Process.spawn のようなプロセスを起動するようなメソッド...