るりまサーチ

最速Rubyリファレンスマニュアル検索!
15件ヒット [1-15件を表示] (0.031秒)
トップページ > クエリ:IO[x] > クエリ:>[x] > クエリ:puts[x] > クエリ:each[x] > クエリ:yaml[x]

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. module >
  4. integer >
  5. complex >

種類

検索結果

yaml (38404.0)

構造化されたデータを表現するフォーマットであるYAML (YAML Ain't Markup Language) を扱うためのライブラリです。

...あるYAML (YAML Ain't Markup Language) を扱うためのライブラリです。

//emlist[例1: 構造化された配列][ruby]{
require 'yaml'

data = ["Taro san", "Jiro san", "Saburo san"]
str_r = YAML.dump(data)

str_l = <<~YAML_EOT
---
- Taro san
- Jiro san
- Saburo san
YAML
_EOT

p st...
...> true
//}

//emlist[例2: 構造化されたハッシュ][ruby]{
require 'yaml'
require 'date'

str_l = <<~YAML_EOT
Tanaka Taro: {age: 35, birthday: 1970-01-01}
Suzuki Suneo: {
age: 13,
birthday: 1992-12-21
}
YAML
_EOT

str_r = {}
str_r["Tanaka Taro"] = {
"age" => 35,
"birthday" =>...
...= {
"age" => 13,
"birthday" => 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:...

NEWS for Ruby 3.0.0 (126.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs...
...o keywords.
16166

//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}

pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]

pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}

* Arguments forwarding (`...`) now supports leading arguments.
16378

//...
...data[(1..).step(2)] # take each second element
# => ["data1", "data2", "data3"]
//}

* Binding
* Binding#eval when called with one argument will use `"(eval)"` for `__FILE__` and `1` for `__LINE__` in the evaluated code. 4352 17419
* ConditionVariable
* ConditionVariable#wait may now inv...