Class: Mime::Mimes

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

Instance Method Summary collapse

Methods included from Enumerable

#as_json, #exclude?, #index_by, #many?, #pluck, #sum, #without

Constructor Details

#initializeMimes

Returns a new instance of Mimes.


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

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

Instance Method Details

#<<(type) ⇒ Object


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

def <<(type)
  @mimes << type
  @symbols = nil
end

#delete_ifObject


25
26
27
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 25

def delete_if
  @mimes.delete_if { |x| yield x }.tap { @symbols = nil }
end

#eachObject


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

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

#symbolsObject


29
30
31
# File 'actionpack/lib/action_dispatch/http/mime_type.rb', line 29

def symbols
  @symbols ||= map(&:to_sym)
end