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

Constant Summary

::Enumerable - Included

INDEX_WITH_DEFAULT

Class Method Summary

Instance Attribute Summary

::Enumerable - Included

#many?

Returns true if the enumerable has more than 1 element.

Instance Method Summary

::Enumerable - Included

#compact_blank

Returns a new ::Array without the blank items.

#exclude?

The negative of the Enumerable#include?.

#excluding

Returns a copy of the enumerable excluding the specified elements.

#including

Returns a new array that includes the passed elements.

#index_by

Convert an enumerable to a hash, using the block result as the key and the element as the value.

#index_with

Convert an enumerable to a hash, using the element as the key and the block result as the value.

#pick

Extract the given key from the first element in the enumerable.

#pluck

Extract the given key from each element in the enumerable.

#sum

Calculates a sum from the elements.

#without

Alias for #excluding.

Constructor Details

.newMimes

[ GitHub ]

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

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

Instance Attribute Details

#symbols (readonly)

[ GitHub ]

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

attr_reader :symbols

Instance Method Details

#<<(type)

[ GitHub ]

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

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

#delete_if

[ GitHub ]

  
# 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

#each

[ GitHub ]

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

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