ライブラリ
- ビルトイン (48)
-
minitest
/ unit (1) - strscan (48)
クラス
-
MiniTest
:: Unit (1) - StringScanner (48)
-
Thread
:: Backtrace :: Location (48)
キーワード
-
absolute
_ path (12) -
base
_ label (12) - inspect (12)
- puke (1)
-
scan
_ full (12) -
search
_ full (12) -
skip
_ until (12) -
to
_ s (12)
検索結果
先頭5件
-
StringScanner
# skip(regexp) -> Integer | nil (21144.0) -
スキャンポインタの地点だけで regexp と文字列のマッチを試します。 マッチしたらスキャンポインタを進めマッチした部分文字列の 長さを返します。マッチしなかったら nil を返します。
...il を返します。
@param regexp マッチに使用する正規表現を指定します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
p s.skip(/\w+/) #=> 4
p s.skip(/\w+/) #=> nil
p s.skip(/\s+/) #=> 1
p s.skip(/\w+/) #=> 6
p s.skip(/./) #=> nil
//}... -
StringScanner
# skip _ until(regexp) -> Integer | nil (9114.0) -
regexp が一致するまで文字列をスキャンします。 マッチに成功したらスキャンポインタを進めて、 スキャン開始位置からマッチ部分の末尾までの部分文字列の長さを返します。 マッチに失敗したら nil を返します。
...長さを返します。
マッチに失敗したら nil を返します。
@param regexp マッチに使用する正規表現を指定します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.scan_until(/str/) # => 8
s.matched # => "str"
s.pos... -
StringScanner
# search _ full(regexp , s , f) -> object (3055.0) -
regexp で指定された正規表現とマッチするまで文字列をスキャンします。
...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? と同等。
@param reg......exp マッチに用いる正規表現を指定します。
@param s true ならばスキャンポインタを進めます。
false ならばスキャンポインタを進めません。
@param f true ならばマッチした部分文字列を返します。
false ならばマッ......n'
s = StringScanner.new('test string')
p s.search_full(/t/, true, true) #=> "t"
p s.search_full(/str/, false, true) #=> "est str"
p s.search_full(/string/, true, true) #=> "est string"
//}
@see StringScanner#scan_until StringScanner#skip_until StringScanner#check_until StringScanner... -
StringScanner
# scan _ full(regexp , s , f) -> object (3049.0) -
スキャンポインタの位置から regexp と文字列のマッチを試します。
...gexp, 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? と同等。
@param regexp マッ......チに用いる正規表現を指定します。
@param s true ならばスキャンポインタを進めます。
false ならばスキャンポインタを進めません。
@param f true ならばマッチした部分文字列を返します。
false ならばマッチした......= StringScanner.new('test string')
p s.scan_full(/\w+/, true, true) #=> "test"
p s.scan_full(/\s+/, false, true) #=> " "
p s.scan_full(/\s+/, true, false) #=> 1
p s.scan_full(/\w+/, false, false) #=> 6
p s.scan_full(/\w+/, true, true) #=> "string"
//}
@see StringScanner#scan StringS... -
MiniTest
:: Unit # puke(klass , method _ name , exception) -> String (132.0) -
テストメソッドの実行結果が成功以外の場合に、その種類と理由を記録します。
...と理由を記録します。
@param klass テストクラスを指定します。
@param method_name テストメソッドの名前を指定します。
@param exception 例外クラスを指定します。
@return 与えられた例外クラスによって "Skip", "Failure", "Error" の... -
Thread
:: Backtrace :: Location # absolute _ path -> String (126.0) -
self が表すフレームの絶対パスを返します。
...][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}
@see Thread::Backtrace::Location#path... -
Thread
:: Backtrace :: Location # base _ label -> String (126.0) -
self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。
...されます。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.base_label
end
# => initialize
# new
# <main>
//}
@see Thread::Backtrace::Location#label... -
Thread
:: Backtrace :: Location # inspect -> String (120.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
...したオブジェクトを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.inspect
end
# => "path/to/foo.rb:5:in `initialize'"
# "path/to/f... -
Thread
:: Backtrace :: Location # to _ s -> String (120.0) -
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。
...現にした文字列を返し
ます。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end
# => path/to/foo.rb:5:in `initialize'
# path/to/foo.rb:9:...