[MacRuby-devel] [MacRuby] #595: our YAML library does not honor #add_builtin_type

MacRuby ruby-noreply at macosforge.org
Tue Feb 2 15:32:28 PST 2010


#595: our YAML library does not honor #add_builtin_type
-----------------------------------+----------------------------------------
 Reporter:  lsansonetti@…          |       Owner:  neeracher@…        
     Type:  defect                 |      Status:  new                
 Priority:  blocker                |   Milestone:                     
Component:  MacRuby                |    Keywords:                     
-----------------------------------+----------------------------------------
 rails 3 uses the following code that does not work on macruby because the
 add_builtin_type method is not implemented:

 {{{
   class OrderedHash #:nodoc:
     def to_yaml_type
       "!tag:yaml.org,2002:omap"
     end

     def to_yaml(opts = {})
       YAML.quick_emit(self, opts) do |out|
         out.seq(taguri, to_yaml_style) do |seq|
           each do |k, v|
             seq.add(k => v)
           end
         end
       end
     end
   end

   YAML.add_builtin_type("omap") do |type, val|
     ActiveSupport::OrderedHash[val.map(&:to_a).map(&:first)]
   end
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/595>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list