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, #compact_blank, #exclude?, #excluding, #including, #index_by, #index_with, #many?, #pluck, #sum, #without

Constructor Details

#initializeMimes


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

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

Instance Method Details

#<<(type) ⇒ Object


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

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

#delete_ifObject


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

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

#eachObject


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

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

#symbolsObject


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

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