トップ 新規 一覧 検索 ヘルプ RSS ログイン

Ya2YAMLの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
It also uses charcoal water filters to clean the impurities out of your water, http://geocities.com/christopherjohnson67/hendergetstoned Hender Get Stoned
 =-O, http://geocities.com/clarkashley86/cybertoollitesale Cybertool Lite Sale
 3194, http://geocities.com/marylewis37/itechbg3600 Itech Bg3600
 >:], http://geocities.com/StephenBrawner/catherinebavolack Catherine Bavolack
 jwsk, http://geocities.com/golden.carrie/yoshimineyasuyo Yoshimine Yasuyo
 801637, http://geocities.com/robertryan48/guidebeam Guidebeam
 737, http://geocities.com/MargaretVarga/servism7065s Servis M7065s
 krr, http://geocities.com/carlosevans44/2clinicaldatalevitra 2clinical Data Levitra
 =D, http://geocities.com/CristinMetcalf/vakkumpumpen Vakkumpumpen
 tskn, http://geocities.com/thomasrick71/songnham Songnham
 374, http://geocities.com/colbert.robin/acautomotive Acautomotive
 =OOO, http://geocities.com/LorraineGuertin/schwinn920i Schwinn 920i
 =DD, http://geocities.com/rubenjones21/mt337b Mt337b
 45485, 
任意のオブジェクトをYAML形式に変換するライブラリ。pure ruby。

https://rubyforge.org/projects/ya2yaml/

標準添付のYAMLライブラリには、マルチバイト文字列をbinary形式として出力してしまう問題([[ruby-list:42204]])があるが、こちらのライブラリを使えばマルチバイト文字列をそのままYAML内へ出力することができる。日本語の出力もOK。

ただしYAMLを読み込む(パースする)機能は持っていないため、読み込みには別のライブラリを使う必要がある。


!!! 使い方
(READMEより転載)

 $KCODE = 'UTF8'
 require 'ya2yaml'
 
 obj = [
   "abc\nxyz\n",
   "日本語\n文字列\n",
   "\xfd\xfe\xff",
 ]
 puts obj.ya2yaml(:syck_compatible => true)


 --- 
 - |
     abc
     xyz
 - |
     日本語
     文字列
 - !binary |
     /f7/

!!! 既知のバグ
* ==複数のドキュメントを一つのyamlファイルに出力し、rubyに標準添付のyamlライブラリで(YAMLストリームとして)読み込むと、エラーで落ちる。==→最新版では修正されている