module ZipContainer::Util
Utility methods useful throughout the rest of the ZipContainer
library.
Public Instance Methods
Source
# File lib/zip-container/util.rb 48 def entry_name(entry) 49 name = entry.is_a?(::Zip::Entry) ? entry.name : entry 50 51 if name.respond_to?(:end_with?) && name.respond_to?(:chop!) 52 name.chop! if name.end_with?('/') 53 end 54 55 name 56 end
A lot of methods can take either a String or a Zip::Entry object to represent an item in a Zip file so this method normalizes these parameters.
In common with rubyzip this method also removes a trailing slash (/) from a name if it can.