12
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

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とか、ちょいとタイポなんてした日にゃあ、全く違う設定になってアワワしてしまいますね!
知らんやったー

12
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
12
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?