123456789_123456789_123456789_123456789_123456789_

Class: Mime::Mimes

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
self, ::Enumerable
Inherits: Object
Defined in: actionpack/lib/action_dispatch/http/mime_type.rb

Class Method Summary

Instance Attribute Summary

::Enumerable - Included

#many?

Returns true if the enumerable has more than 1 element.

Instance Method Summary

::Enumerable - Included

#exclude?

The negative of the Enumerable#include?.

#index_by

Convert an enumerable to a hash.

#pluck

Convert an enumerable to an array based on the given key.

#sum

Calculates a sum from the elements.

#without

Returns a copy of the enumerable without the specified elements.

Constructor Details

.newMimes

[ GitHub ]

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

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

Instance Method Details

#<<(type)

[ GitHub ]

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

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

#delete_if

[ GitHub ]

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

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

#each

[ GitHub ]

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

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

#symbols

[ GitHub ]

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

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