Skip to content

Commit

Permalink
remove unnecessary object duplication
Browse files Browse the repository at this point in the history
`load_from_json` returns a list of newly created MIME::Type objects, so
there is no need to loop through all of them again, convert them to
hashes, then allocate duplicate MIME::Type objects.

<3<3
  • Loading branch information
tenderlove committed Oct 14, 2014
1 parent 6c75ee5 commit 2fc2cd7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/mime/types/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ def load_yaml
# This method is aliased to #load.
def load_json
Dir[json_path].sort.each do |f|
types = self.class.load_from_json(f).map { |type|
MIME::Type.new(type)
}
types = self.class.load_from_json(f)
container.add(*types, :silent)
end
container
Expand Down

0 comments on commit 2fc2cd7

Please sign in to comment.