12件ヒット
[1-12件を表示]
(0.046秒)
別のキーワード
検索結果
-
yaml (61.0)
-
構造化されたデータを表現するフォーマットであるYAML (YAML Ain't Markup Language) を扱うためのライブラリです。
...=> Date.new(1992, 12, 21)
}
p str_r == YAML.load(str_l) # => true
//}
//emlist[例3: 構造化されたログ][ruby]{
require 'yaml'
require 'stringio'
strio_r = StringIO.new(<<~YAML_EOT)
---
time: 2008-02-25 17:03:12 +09:00
target: YAML
version: 4
log: |
例を加えた。
ア......00
target: YAML
version: 3
log: |
アブストラクトを書いた。
YAML_EOT
YAML.load_stream(strio_r).sort_by{ |a| a["version"] }.each do |obj|
puts "version %d\ntime %s\ntarget:%s\n%s\n" % obj.values_at("version", "time", "target", "log")
end
# =>
# version 3
# time 2008-02-24......17:00:35 +0900
# target:YAML
# アブストラクトを書いた。
#
# version 4
# time 2008-02-25 17:03:12 +0900
# target:YAML
# 例を加えた。
# アブストラクトを修正した。
#
//}
=== バックエンドの選択
yaml ライブラリでは、以下のライブラリをバ... -
test
/ unit (19.0) -
ユニットテストを行うためのライブラリです。
...のプロジェクトページを参照してください。
* Test::Unit - Ruby用単体テストフレームワーク: https://test-unit.github.io/
なお、2.2.0より前のtest/unit は当時バンドルしていた minitest/unit を使って再実装し
ていましたが、上記のtest/un......$ ruby test_foo.rb
Loaded suite test_foo
Started
F.
Finished in 0.022223 seconds.
1) Failure:
test_bar(TC_Foo) [test_foo.rb:16]:
<"bar"> expected but was
<"foo">.
2 tests, 2 assertions, 1 failures, 0 errors, 0 ski......by test_foo.rb --name test_bar
Loaded suite test_foo
Started
F
Finished in 0.019573 seconds.
1) Failure:
test_bar(TC_Foo) [test_foo.rb:16]:
<"bar"> expected but was
<"foo">.
1 tests, 1 assertions, 1 failures, 0 errors, 0 sk...