4件ヒット
[1-4件を表示]
(0.018秒)
別のキーワード
クラス
- NoMethodError (1)
- OpenStruct (1)
- Regexp (2)
キーワード
-
last
_ match (2) - new (2)
検索結果
先頭4件
-
NoMethodError
. new(error _ message = "" , name = nil , args = nil) -> NoMethodError (63325.0) -
例外オブジェクトを生成して返します。
例外オブジェクトを生成して返します。
@param error_message エラーメッセージを表す文字列です
@param name 未定義だったシンボルです
@param args メソッド呼び出しに使われた引数です
例:
nom = NoMethodError.new("message", "foo", [1,2,3])
p nom.name
p nom.args
# => "foo"
[1, 2, 3] -
OpenStruct
. new(hash = nil) -> OpenStruct (22.0) -
OpenStruct オブジェクトを生成します。
OpenStruct オブジェクトを生成します。
ハッシュが与えられたとき、それぞれのキーを生成したオブジェクトの要素にし、値をセットします。
@param hash 設定する要素とその値を指定します。
hash には Hash クラスのインスタンス、または each_pair メソッ
ドを持つオブジェクトを用いる事ができます。
@raise NoMethodError hash のキーが to_sym メソッドを持たないときに発生します。
require 'ostruct'
some1 = OpenStruct.new({:a =>"a",:b =... -
Regexp
. last _ match(nth) -> String | nil (22.0) -
整数 nth が 0 の場合、マッチした文字列を返します ($&)。それ以外では、nth 番目の括弧にマッチ した部分文字列を返します($1,$2,...)。 対応する括弧がない場合やマッチしなかった場合には nil を返し ます。
整数 nth が 0 の場合、マッチした文字列を返します
($&)。それ以外では、nth 番目の括弧にマッチ
した部分文字列を返します($1,$2,...)。
対応する括弧がない場合やマッチしなかった場合には nil を返し
ます。
//emlist[例][ruby]{
/(.)(.)/ =~ "ab"
p Regexp.last_match # => #<MatchData:0x4599e58>
p Regexp.last_match(0) # => "ab"
p Regexp.last_match(1) # => "a"
p Regexp.last_match(2) ... -
Regexp
. last _ match -> MatchData (7.0) -
カレントスコープで最後に行った正規表現マッチの MatchData オ ブジェクトを返します。このメソッドの呼び出しは $~ の参照と同じです。
カレントスコープで最後に行った正規表現マッチの MatchData オ
ブジェクトを返します。このメソッドの呼び出しは $~
の参照と同じです。
//emlist[例][ruby]{
/(.)(.)/ =~ "ab"
p Regexp.last_match # => #<MatchData:0x4599e58>
p Regexp.last_match[0] # => "ab"
p Regexp.last_match[1] # => "a"
p Regexp.last_match[2] # => "b"
p Regexp.last_match[3] # => nil...