Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4399

Show
Ignore:
Timestamp:
06/01/06 23:23:24 (2 years ago)
Author:
david
Message:

Dont keep nothing as a lookup [DHH]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/mime_type.rb

    r4384 r4399  
    3535        # keep track of creation order to keep the subsequent sort stable 
    3636        index = 0 
    37         list = accept_header.split(/,/). 
    38           map! { |i| AcceptItem.new(index += 1, *i.split(/;\s*q=/)) }.sort! 
     37        list = accept_header.split(/,/).map! do |i|  
     38          AcceptItem.new(index += 1, *i.split(/;\s*q=/)) 
     39        end.sort! 
    3940 
    4041        # Take care of the broken text/xml entry by renaming or deleting it 
    41    
    4242        text_xml = list.index("text/xml") 
    4343        app_xml = list.index("application/xml") 
     
    121121 
    122122 
    123   LOOKUP = Hash.new { |h, k| h[k] = Type.new(k)
     123  LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k == ""
    124124 
    125125  LOOKUP["*/*"]                      = ALL 
     
    143143 
    144144   
    145   EXTENSION_LOOKUP = Hash.new { |h, k| h[k] = Type.new(k)
     145  EXTENSION_LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k == ""
    146146 
    147147  EXTENSION_LOOKUP["html"]  = HTML 
  • trunk/actionpack/test/controller/mime_type_test.rb

    r4394 r4399  
    66 
    77  def test_parse_single 
    8 p Mime::LOOKUP.keys.sort 
    98    Mime::LOOKUP.keys.each do |mime_type| 
    109      assert_equal [Mime::Type.lookup(mime_type)], Mime::Type.parse(mime_type)