LoginSignup
11
3

More than 5 years have passed since last update.

YAMLのデータ型「真偽値」の自動判別

Posted at

YAMLのデータ型「真偽値」の自動判別

以下のデータはYAMLでは真偽値として自動判別され、それぞれtrue/falseとなるらしい

sample.yml

---
a: true
b: false
c: yes
d: no
e: on
f: off
YAML.load(open("sample.yml"))
=> {"a"=>true, "b"=>false, "c"=>true, "d"=>false, "e"=>true, "f"=>false}

true=yes=onがtrueで、false=no=offがfalse

onnoとか、ちょいとタイポなんてした日にゃあ、全く違う設定になってアワワしてしまいますね!

知らんやったー

11
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
3