fix rubocop Style/Alias cop

This commit is contained in:
Pavel.Lobashov 2015-03-20 23:17:05 +03:00
parent 7ef15bd201
commit bb08213cb7
9 changed files with 23 additions and 28 deletions

View File

@ -61,11 +61,6 @@ Metrics/PerceivedComplexity:
Style/AccessorMethodName:
Enabled: false
# Offense count: 23
# Cop supports --auto-correct.
Style/Alias:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
Style/AlignArray:

View File

@ -83,7 +83,7 @@ module Zip
end
end
alias :mtime :time
alias_method :mtime, :time
def time=(value)
unless @extra.member?('UniversalTime') || @extra.member?('NTFS')

View File

@ -23,13 +23,13 @@ module Zip
@entry_set[to_key(entry)] = entry
end
alias :push :<<
alias_method :push, :<<
def size
@entry_set.size
end
alias :length :size
alias_method :length, :size
def delete(entry)
if @entry_set.delete(to_key(entry))

View File

@ -69,7 +69,7 @@ module Zip
ordered_values.map! { |v| v.to_local_bin.force_encoding('BINARY') }.join
end
alias :to_s :to_local_bin
alias_method :to_s, :to_local_bin
def to_c_dir_bin
ordered_values.map! { |v| v.to_c_dir_bin.force_encoding('BINARY') }.join
@ -83,8 +83,8 @@ module Zip
to_local_bin.bytesize
end
alias :length :local_size
alias :size :local_size
alias_method :length, :local_size
alias_method :size, :local_size
end
end

View File

@ -183,26 +183,26 @@ module Zip
def exists?(fileName)
expand_path(fileName) == "/" || @mappedZip.find_entry(fileName) != nil
end
alias :exist? :exists?
alias_method :exist?, :exists?
# Permissions not implemented, so if the file exists it is accessible
alias owned? exists?
alias grpowned? exists?
alias_method :owned?, :exists?
alias_method :grpowned?, :exists?
def readable?(fileName)
unix_mode_cmp(fileName, 0444)
end
alias readable_real? readable?
alias_method :readable_real?, :readable?
def writable?(fileName)
unix_mode_cmp(fileName, 0222)
end
alias writable_real? writable?
alias_method :writable_real?, :writable?
def executable?(fileName)
unix_mode_cmp(fileName, 0111)
end
alias executable_real? executable?
alias_method :executable_real?, :executable?
def setuid?(fileName)
unix_mode_cmp(fileName, 04000)
@ -385,7 +385,7 @@ module Zip
ZipFsStat.new(self, fileName)
end
alias lstat stat
alias_method :lstat, :stat
def readlines(fileName)
open(fileName) { |is| is.readlines }
@ -417,7 +417,7 @@ module Zip
@mappedZip.rename(fileToRename, newName) { true }
end
alias :unlink :delete
alias_method :unlink, :delete
def expand_path(aPath)
@mappedZip.expand_path(aPath)
@ -456,7 +456,7 @@ module Zip
end
def pwd; @mappedZip.pwd; end
alias getwd pwd
alias_method :getwd, :pwd
def chdir(aDirectoryName)
unless @file.stat(aDirectoryName).directory?
@ -496,8 +496,8 @@ module Zip
end
@mappedZip.remove(entryName)
end
alias rmdir delete
alias unlink delete
alias_method :rmdir, :delete
alias_method :unlink, :delete
def mkdir(entryName, permissionInt = 0755)
@mappedZip.mkdir(entryName, permissionInt)

View File

@ -33,8 +33,8 @@ module Zip
@output_buffer.empty? && internal_input_finished?
end
alias :eof :input_finished?
alias :eof? :input_finished?
alias_method :eof, :input_finished?
alias_method :eof?, :input_finished?
private

View File

@ -86,7 +86,7 @@ module Zip
@output_buffer.empty? && @decompressor.eof
end
alias :eof? :eof
alias_method :eof?, :eof
class << self
# Same as #initialize but if a block is passed the opened

View File

@ -18,7 +18,7 @@ module Zip
true
end
alias :eof? :eof
alias_method :eof?, :eof
end
end

View File

@ -31,8 +31,8 @@ module Zip
@read_so_far >= @chars_to_read
end
alias :eof :input_finished?
alias :eof? :input_finished?
alias_method :eof, :input_finished?
alias_method :eof?, :input_finished?
end
end