YAML::Emitter#emit does not return a string
-------------------------------------------
Key: JRUBY-3060
URL: http://jira.codehaus.org/browse/JRUBY-3060
Project: JRuby
Issue Type: Bug
Components: Miscellaneous
Affects Versions: JRuby 1.1.4
Environment: Soylatte 1.0.3
Reporter: Michael S. Allman
Attachments: yaml_emitter_to_s.patch
YAML::Emitter#emit, defined in builtin/yaml.rb, does not return a string. I
believe it should, at least to work the same as C Ruby. It seems sometimes it
does and sometimes it doesn't. See the attached patch, which includes a unit
test case.
In C Ruby, a custom to_yaml() method such as
def to_yaml(opts = {})
YAML::quick_emit( object_id, opts ) do |out|
out.map( taguri, to_yaml_style ) do |map|
to_yaml_properties.each do |m|
map.add( m[1..-1], instance_variable_get( m ) )
end
end
end
end
on a class T will ensure that T.new.to_yaml.class is String. In JRuby, it
returns a YAML::JvYAML::Map. It should return a String, no?
Attached patch includes a proposed fix, though I'm not familiar enough with the
code in question to know for sure this is the correct fix.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email