[MacRuby/MacRuby] 29a5e8: String#to_yaml returns the string of yaml with lit...
Branch: refs/heads/master Home: https://github.com/MacRuby/MacRuby Commit: 29a5e837c1bb422d6d829827018162b27d30c271 https://github.com/MacRuby/MacRuby/commit/29a5e837c1bb422d6d829827018162b27d... Author: Watson <watson1978@gmail.com> Date: 2011-08-15 (Mon, 15 Aug 2011) Changed paths: M ext/libyaml/rubyext.c M lib/yaml/rubytypes.rb Log Message: ----------- String#to_yaml returns the string of yaml with literal style when includes the newlines. Test Script: {{{ require 'yaml' require 'test/unit/assertions.rb' include Test::Unit::Assertions str = "hoge\nfoo" def str.to_yaml_style end yaml = str.to_yaml assert_match(/^--- \|-\n/, yaml) puts :ok }}} Commit: 54e77a51e1ee0a9839bb6571b22dec85011181c3 https://github.com/MacRuby/MacRuby/commit/54e77a51e1ee0a9839bb6571b22dec8501... Author: Watson <watson1978@gmail.com> Date: 2011-08-15 (Mon, 15 Aug 2011) Changed paths: M ext/libyaml/emitter.c Log Message: ----------- Indentation is not required with literal and fold style. Test Script: {{{ require 'yaml' require 'test/unit/assertions.rb' include Test::Unit::Assertions str = "hoge\nfoo" yaml = str.to_yaml assert_equal("--- |-\nhoge\nfoo\n", yaml) str = "hoge\nfoo" def str.to_yaml_style :fold end yaml = str.to_yaml assert_equal("--- >-\nhoge\n\nfoo\n", yaml) puts :ok }}} Compare: https://github.com/MacRuby/MacRuby/compare/ecde1c7...54e77a5
participants (1)
-
noreply@github.com