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

Ya2YAMLの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
Harvesting email addresses in a deceptive manner and using these addresses to send out mass emails will likely always be considered to be spam, http://geocities.com/EdnaMoorer/glockg21sf Glock G21sf
 kfngbs, http://geocities.com/GeraldineAcree/downloadaajmerajeekardasong Download Aaj Mera Jee Karda Song
 zlt, http://geocities.com/schumancarl/gueneapig Guenea Pig
 >:]]], http://geocities.com/sarah.tallent/answerstotitantestnoesis Answers To Titan Test Noesis
 %-), http://geocities.com/remerkyle/katskarachistockexchange Kats Karachi Stock Exchange
 =))), http://geocities.com/fryalberta/hiendlregensburg Hiendl Regensburg
 =-PPP, http://geocities.com/williamrodriguez42/latexlair Latexlair
 8PP, http://geocities.com/hartzlerapril/kbrodycz Kbrodycz
 845299, http://geocities.com/jacobs.norman/teddybeardcards Teddybeard Cards
 >:))), http://geocities.com/chasewashington48/enkutatash Enkutatash
 805830, http://geocities.com/kelly.denton/lemonadeandlove Lemonadeandlove
 6090, http://geocities.com/marquez_marshall/picobelloandalucita Picobello Andalucita
 =-[[[, http://geocities.com/PhillipDryman/plungebars Plungebars
 %OOO, http://geocities.com/DarleenJinks/plantageneti Plantageneti
 26106, http://geocities.com/donahue.shawn/rainbownotion Rainbownotion
 7203, http://geocities.com/elmore.sandra/kimosetter Kimosetter
 0527, 
任意のオブジェクトを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ストリームとして)読み込むと、エラーで落ちる。==→最新版では修正されている