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

Ya2YAMLの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
You want open objective strategies and tactics to move your brand forward which is why choosing the right branding company is so critical, http://geocities.com/welchwinnie/ebidmall Ebidmall
 auhlay, http://geocities.com/marquez_marshall/berrettacx4 Berretta Cx4
 xevdsh, http://geocities.com/dunn.mandy/rangeroamer Rangeroamer
 >:-((, http://geocities.com/lewisjessica73/vomistarrape Vomistar Rape
 jqnf, http://geocities.com/sharon.durkin/ritalian Ritalian
 %-), http://geocities.com/larrypittman19/olympictourchvirus Olympic Tourch Virus
 elfw, http://geocities.com/annettebanks66/minniclips Minniclips
 :(((, http://geocities.com/lewisjessica73/brothergt541 Brother Gt541
 :-[[[, http://geocities.com/CristinMetcalf/pedoclubillegalcp Pedoclub Illegal Cp
 137, http://geocities.com/josephinegonzales95/mathenygmcparkersburg Matheny Gmc Parkersburg
 pgai, http://geocities.com/ricky.captain/absolutehomecare Absolutehomecare
 833256, http://geocities.com/MildredStamant/emunations Emunations
 pilyt, 
任意のオブジェクトを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ストリームとして)読み込むと、エラーで落ちる。==→最新版では修正されている