種類
- インスタンスメソッド (45)
- 文書 (15)
- 特異メソッド (11)
- ライブラリ (1)
ライブラリ
- csv (11)
-
minitest
/ unit (1) - strscan (44)
クラス
- CSV (11)
- StringScanner (44)
モジュール
キーワード
-
NEWS for Ruby 3
. 0 . 0 (4) -
minitest
/ unit (1) - new (11)
-
ruby 1
. 8 . 4 feature (11) -
scan
_ full (11) -
search
_ full (11) -
skip
_ until (11)
検索結果
先頭5件
-
MiniTest
:: Assertions # skip(message = nil , backtrace = caller) (21208.0) -
このメソッドを呼び出したテストメソッドをスキップします。
...ます。
@param message メッセージを指定します。
@param backtrace 例外発生時のスタックトレースで、Kernel.#caller の戻り値と同じ
形式で指定しなければいけません。
@raise MiniTest::Skip 必ず発生します。
@see Kernel.#raise... -
StringScanner
# skip(regexp) -> Integer | nil (18266.0) -
スキャンポインタの地点だけで regexp と文字列のマッチを試します。 マッチしたらスキャンポインタを進めマッチした部分文字列の 長さを返します。マッチしなかったら nil を返します。
... nil を返します。
@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 (6230.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 # => 8
s.pre_match # => "test "
//}... -
minitest
/ unit (6132.0) -
ユニットテストを行うためのライブラリです。
...ラリです。
=== 使い方
minitest/unit は以下のように使います。
テスト対象のソース (foo.rb) を用意します。
class Foo
def foo
"foo"
end
def bar
"foo"
end
end
次にユニットテスト (test_foo.rb) を書きます。
テストを......ません。
require 'minitest/unit'
require 'foo'
MiniTest::Unit.autorun
class TestFoo < MiniTest::Unit::TestCase
def setup
@foo = Foo.new
end
# teardown はあまり使わない
def teardown
@foo = nil
end
def test_foo
assert_equal "foo",......が実行されます。
$ ruby test_foo.rb
Loaded suite test_foo
Started
F.
Finished in 0.000940 seconds.
1) Failure:
test_bar(TestFoo) [test_foo.rb:20]:
Expected "bar", not "foo".
2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
test_bar だけテストしたい場... -
ruby 1
. 8 . 4 feature (264.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...ruby 1.8.4 feature/printf [bug]>))
* ((<ruby 1.8.4 feature/Hash [bug]>))
* ((<ruby 1.8.4 feature/test [bug]>))
* ((<ruby 1.8.4 feature/File.identical? [new]>))
* ((<ruby 1.8.4 feature/FileTest.identical? [new]>))
* ((<ruby 1.8.4 feature/File.split [change]>))
* ((<ruby 1.8.4 feature/File......z]+x[0-9]+$/ =~ "hogex111")
p(/^[\x61-\x7a]+x[0-9]+$/ =~ "hogex111")
# => ruby 1.8.3 (2005-09-21) [i686-linux]
0
nil
# => ruby 1.8.4 (2005-12-22) [i686-linux]
0
0
: シグナル [bug]
#Sun Oct 16 03:38:07 2005 Yukihiro M......tical? [new]
: FileTest.identical? [new]
test(?-, ...) の代替メソッドとして追加。
: File.split [change]
: File.basename [change]
: File.dirname [change]
#Tue Nov 22 14:46:57 2005 NAKAMURA Usaku <usa@ruby-lang.org>
#
# * file.c (rb_file_s_basename): skip slashes just after... -
NEWS for Ruby 3
. 0 . 0 (48.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...`true` will cause compaction to occur during major collections. At the moment, compaction adds significant overhead to major collections, so please test first! 17176
* Hash
* Hash#transform_keys and Hash#transform_keys! now accept a hash that maps keys to new keys. 16274
* Hash#except h......et
* Add :connect_timeout to TCPSocket.new 17187
* Net::HTTP
* Net::HTTP#verify_hostname= and Net::HTTP#verify_hostname have been added to skip hostname verification. 16555
* Net::HTTP.get, Net::HTTP.get_response, and Net::HTTP.get_print can take the request headers as a Hash in the s......da's arity check.
* When writing to STDOUT redirected to a closed pipe, no broken pipe error message will be shown now. 14413
* `TRUE`/`FALSE`/`NIL` constants are no longer defined.
* Integer#zero? overrides Numeric#zero? for optimization. 16961
* Enumerable#grep and Enumerable#grep_v when... -
CSV
. new(data , options = Hash . new) -> CSV (30.0) -
このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。
...limit to
prevent what are effectively DoS attacks on the parser. However, this
limit can cause a legitimate parse to fail and thus is set to +nil+, or off,
by default.
: :converters
CSV::Converters から取り出した名前の配列です。変換器が一つだけ
の場合は配列......した場合はヘッダは変換されま
せん。
: :skip_blanks
真を指定すると、空行を読み飛ばします。
: :force_quotes
真を指定すると、全てのフィールドを作成時にクオートします。
: :skip_lines
指定した正規表現にマッチしたそれ......e "csv"
users =<<-EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write("test.csv", users)
File.open("test.csv", "r") do |f|
csv = CSV.new(f, headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first name":"taro" "l... -
StringScanner
# scan _ full(regexp , s , f) -> object (30.0) -
スキャンポインタの位置から regexp と文字列のマッチを試します。
...関係なく nil を返します。
このメソッドは s と f の組み合わせにより、
他のメソッドと同等の動作になります。
* scan_full(regexp, true, true) は StringScanner#scan と同等。
* scan_full(regexp, true, false) は StringScanner#skip と同等。......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 StringScanner#skip Stri... -
StringScanner
# search _ full(regexp , s , f) -> object (24.0) -
regexp で指定された正規表現とマッチするまで文字列をスキャンします。
...係なく nil を返します。
このメソッドは s と f の組み合わせにより、
他のメソッドと同等の動作になります。
* search_full(regexp, true, true) は StringScanner#scan_until と同等。
* search_full(regexp, true, false) は StringScanner#skip_until......re 'strscan'
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 Str...