class Swaggable::MimeTypesCollection

Attributes

list[R]

Public Class Methods

new() click to toggle source
# File lib/swaggable/mime_types_collection.rb, line 13
def initialize
  @list = []
end

Public Instance Methods

<<(entry) click to toggle source
# File lib/swaggable/mime_types_collection.rb, line 17
def << entry
  entry = case entry
          when Symbol, String then MimeTypeDefinition.new entry
          else entry
          end

  if n = list.index(entry)
    list[n] = entry
  else
    list << entry
  end
end
==(other) click to toggle source
# File lib/swaggable/mime_types_collection.rb, line 46
def == other
  count == other.count && other.each {|e| include? e }
end
Also aliased as: eql?
[](key) click to toggle source
# File lib/swaggable/mime_types_collection.rb, line 34
def [] key
  list.detect {|e| e == key }
end
each(*args, &block) click to toggle source
# File lib/swaggable/mime_types_collection.rb, line 30
def each *args, &block
  list.each(*args, &block)
end
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/swaggable/mime_types_collection.rb, line 52
def hash
  name.hash
end
inspect() click to toggle source
# File lib/swaggable/mime_types_collection.rb, line 38
def inspect
  "#<Swaggable::MimeTypesCollection: #{list.map(&:name).join(', ')}>"
end
merge!(other) click to toggle source
# File lib/swaggable/mime_types_collection.rb, line 42
def merge! other
  other.each {|e| self << e }
end