60件ヒット
[1-60件を表示]
(0.174秒)
別のキーワード
クラス
- Object (12)
- StringScanner (48)
キーワード
- === (12)
-
check
_ until (12) -
scan
_ full (12) -
search
_ full (12)
検索結果
先頭5件
-
StringScanner
# check(regexp) -> String | nil (24327.0) -
現在位置から regexp とのマッチを試みます。 マッチに成功したらマッチした部分文字列を返します。 マッチに失敗したら nil を返します。
...を進めません。
@param regexp マッチに用いる正規表現を指定します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.check(/\w+/) # => "test"
s.pos # => 0
s.matched # => "test"
s.check(/\s+/) # => nil
s.matched # => nil
//}... -
StringScanner
# check _ until(regexp) -> String | nil (15321.0) -
regexp が一致するまで文字列をスキャンします。 マッチに成功したらスキャン開始位置からマッチ部分の末尾までの部分文字列を返します。 マッチに失敗したら nil を返します。
...めません。
@param regexp マッチに用いる正規表現を指定します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.check_until(/str/) # => "test str"
s.matched # => "str"
s.pos # => 0
s.pre_match # => "test "
//}... -
StringScanner
# search _ full(regexp , s , f) -> object (6149.0) -
regexp で指定された正規表現とマッチするまで文字列をスキャンします。
...、s と f の値によって以下のように動作します。
* s が true ならばスキャンポインタを進めます。
* s が false ならばスキャンポインタを進めません。
* f が true ならばスキャン開始位置からマッチした部分の末尾ま......ll(regexp, true, true) は StringScanner#scan_until と同等。
* search_full(regexp, true, false) は StringScanner#skip_until と同等。
* search_full(regexp, false, true) は StringScanner#check_until と同等。
* search_full(regexp, false, false) は StringScanner#exist? と同......am s true ならばスキャンポインタを進めます。
false ならばスキャンポインタを進めません。
@param f true ならばマッチした部分文字列を返します。
false ならばマッチした部分文字列の長さを返します。
//emlist[例... -
StringScanner
# scan _ full(regexp , s , f) -> object (6131.0) -
スキャンポインタの位置から regexp と文字列のマッチを試します。
...、s と f の値によって以下のように動作します。
* s が true ならばスキャンポインタを進めます。
* s が false ならばスキャンポインタを進めません。
* f が true ならばマッチした部分文字列を返します。
* f が fals......* scan_full(regexp, true, true) は StringScanner#scan と同等。
* scan_full(regexp, true, false) は StringScanner#skip と同等。
* scan_full(regexp, false, true) は StringScanner#check と同等。
* scan_full(regexp, false, false) は StringScanner#match? と同等。
@par......am s true ならばスキャンポインタを進めます。
false ならばスキャンポインタを進めません。
@param f true ならばマッチした部分文字列を返します。
false ならばマッチした部分文字列の長さを返します。
//emlist[例... -
Object
# ===(other) -> bool (3179.0) -
case 式で使用されるメソッドです。d:spec/control#case も参照してください。
...用されるメソッドです。d:spec/control#case も参照してください。
このメソッドは case 式での振る舞いを考慮して、
各クラスの性質に合わせて再定義すべきです。
デフォルトでは内部で Object#== を呼び出します。
when 節の式......ther 比較するオブジェクトです。
//emlist[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12), ... が実行される
result =
case age
when 0 .. 2
"baby"
when 3 .. 6
"little child"
when 7 .. 12
"child"
when 13 .. 18
"youth"
else
"adult"
end
puts result......def check arg
case arg
when /ruby(?!\s*on\s*rails)/i
"hit! #{arg}"
when String
"Instance of String class. But don't hit."
else
"unknown"
end
end
puts check([]) #=> unknown
puts check("mash-up in Ruby on Rails") #=> instance of String class. But not hit...
puts check("<Ruby's...