Class: Mime::Mimes

Inherits:
Object show all
Includes:
Enumerable
Defined in:
actionpack/lib/action_dispatch/http/mime_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Enumerable

#as_json, #compact_blank, #exclude?, #excluding, #including, #index_by, #index_with, #many?, #pick, #pluck, #sum, #without

Constructor Details

#initializeMimes

Returns a new instance of Mimes.


12
13
14
15
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 12

def initialize
  @mimes = []
  @symbols = []
end

Instance Attribute Details

#symbolsObject (readonly)

Returns the value of attribute symbols


8
9
10
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 8

def symbols
  @symbols
end

Instance Method Details

#<<(type) ⇒ Object


21
22
23
24
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 21

def <<(type)
  @mimes << type
  @symbols << type.to_sym
end

#delete_ifObject


26
27
28
29
30
31
32
33
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 26

def delete_if
  @mimes.delete_if do |x|
    if yield x
      @symbols.delete(x.to_sym)
      true
    end
  end
end

#eachObject


17
18
19
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 17

def each
  @mimes.each { |x| yield x }
end