redone fixes by rubocop Style/Alias to be in style of https://github.com/bbatsov/ruby-style-guide#alias-method-lexically

This commit is contained in:
Pavel Lobashov 2015-03-21 13:14:21 +03:00
parent da863e4b55
commit b730387cf2
8 changed files with 23 additions and 23 deletions

View File

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

View File

@ -21,13 +21,13 @@ module Zip
@entry_set[to_key(entry)] = entry @entry_set[to_key(entry)] = entry
end end
alias_method :push, :<< alias push <<
def size def size
@entry_set.size @entry_set.size
end end
alias_method :length, :size alias length size
def delete(entry) def delete(entry)
if @entry_set.delete(to_key(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 ordered_values.map! { |v| v.to_local_bin.force_encoding('BINARY') }.join
end end
alias_method :to_s, :to_local_bin alias to_s to_local_bin
def to_c_dir_bin def to_c_dir_bin
ordered_values.map! { |v| v.to_c_dir_bin.force_encoding('BINARY') }.join ordered_values.map! { |v| v.to_c_dir_bin.force_encoding('BINARY') }.join
@ -83,8 +83,8 @@ module Zip
to_local_bin.bytesize to_local_bin.bytesize
end end
alias_method :length, :local_size alias length local_size
alias_method :size, :local_size alias size local_size
end end
end end

View File

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

View File

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

View File

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

View File

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

View File

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