From b730387cf2af11e27fef4c50153fcac4b163a7df Mon Sep 17 00:00:00 2001 From: Pavel Lobashov Date: Sat, 21 Mar 2015 13:14:21 +0300 Subject: [PATCH] redone fixes by rubocop Style/Alias to be in style of https://github.com/bbatsov/ruby-style-guide#alias-method-lexically --- lib/zip/entry.rb | 2 +- lib/zip/entry_set.rb | 4 ++-- lib/zip/extra_field.rb | 6 +++--- lib/zip/filesystem.rb | 22 +++++++++++----------- lib/zip/inflater.rb | 4 ++-- lib/zip/input_stream.rb | 2 +- lib/zip/null_decompressor.rb | 2 +- lib/zip/pass_thru_decompressor.rb | 4 ++-- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/zip/entry.rb b/lib/zip/entry.rb index ac416ff..601eee1 100755 --- a/lib/zip/entry.rb +++ b/lib/zip/entry.rb @@ -83,7 +83,7 @@ module Zip end end - alias_method :mtime, :time + alias mtime time def time=(value) unless @extra.member?('UniversalTime') || @extra.member?('NTFS') diff --git a/lib/zip/entry_set.rb b/lib/zip/entry_set.rb index 62ecebf..3e40d94 100755 --- a/lib/zip/entry_set.rb +++ b/lib/zip/entry_set.rb @@ -21,13 +21,13 @@ module Zip @entry_set[to_key(entry)] = entry end - alias_method :push, :<< + alias push << def size @entry_set.size end - alias_method :length, :size + alias length size def delete(entry) if @entry_set.delete(to_key(entry)) diff --git a/lib/zip/extra_field.rb b/lib/zip/extra_field.rb index ad6ee05..d8bf730 100755 --- a/lib/zip/extra_field.rb +++ b/lib/zip/extra_field.rb @@ -69,7 +69,7 @@ module Zip ordered_values.map! { |v| v.to_local_bin.force_encoding('BINARY') }.join end - alias_method :to_s, :to_local_bin + alias 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_method :length, :local_size - alias_method :size, :local_size + alias length local_size + alias size local_size end end diff --git a/lib/zip/filesystem.rb b/lib/zip/filesystem.rb index 0833c44..fd80821 100755 --- a/lib/zip/filesystem.rb +++ b/lib/zip/filesystem.rb @@ -177,26 +177,26 @@ module Zip def exists?(fileName) expand_path(fileName) == '/' || @mappedZip.find_entry(fileName) != nil end - alias_method :exist?, :exists? + alias exist? exists? # Permissions not implemented, so if the file exists it is accessible - alias_method :owned?, :exists? - alias_method :grpowned?, :exists? + alias owned? exists? + alias grpowned? exists? def readable?(fileName) unix_mode_cmp(fileName, 0444) end - alias_method :readable_real?, :readable? + alias readable_real? readable? def writable?(fileName) unix_mode_cmp(fileName, 0222) end - alias_method :writable_real?, :writable? + alias writable_real? writable? def executable?(fileName) unix_mode_cmp(fileName, 0111) end - alias_method :executable_real?, :executable? + alias executable_real? executable? def setuid?(fileName) unix_mode_cmp(fileName, 04000) @@ -379,7 +379,7 @@ module Zip ZipFsStat.new(self, fileName) end - alias_method :lstat, :stat + alias lstat stat def readlines(fileName) open(fileName) { |is| is.readlines } @@ -410,7 +410,7 @@ module Zip @mappedZip.rename(fileToRename, newName) { true } end - alias_method :unlink, :delete + alias unlink delete def expand_path(aPath) @mappedZip.expand_path(aPath) @@ -448,7 +448,7 @@ module Zip end def pwd; @mappedZip.pwd; end - alias_method :getwd, :pwd + alias getwd pwd def chdir(aDirectoryName) unless @file.stat(aDirectoryName).directory? @@ -487,8 +487,8 @@ module Zip end @mappedZip.remove(entryName) end - alias_method :rmdir, :delete - alias_method :unlink, :delete + alias rmdir delete + alias unlink delete def mkdir(entryName, permissionInt = 0755) @mappedZip.mkdir(entryName, permissionInt) diff --git a/lib/zip/inflater.rb b/lib/zip/inflater.rb index f41626a..e1cbeb2 100755 --- a/lib/zip/inflater.rb +++ b/lib/zip/inflater.rb @@ -33,8 +33,8 @@ module Zip @output_buffer.empty? && internal_input_finished? end - alias_method :eof, :input_finished? - alias_method :eof?, :input_finished? + alias :eof input_finished? + alias :eof? input_finished? private diff --git a/lib/zip/input_stream.rb b/lib/zip/input_stream.rb index 5fbf139..76ab4eb 100755 --- a/lib/zip/input_stream.rb +++ b/lib/zip/input_stream.rb @@ -86,7 +86,7 @@ module Zip @output_buffer.empty? && @decompressor.eof end - alias_method :eof?, :eof + alias :eof? eof class << self # Same as #initialize but if a block is passed the opened diff --git a/lib/zip/null_decompressor.rb b/lib/zip/null_decompressor.rb index a3b40e1..d174e23 100755 --- a/lib/zip/null_decompressor.rb +++ b/lib/zip/null_decompressor.rb @@ -18,7 +18,7 @@ module Zip true end - alias_method :eof?, :eof + alias eof? eof end end diff --git a/lib/zip/pass_thru_decompressor.rb b/lib/zip/pass_thru_decompressor.rb index 2b3500a..ca30f5d 100755 --- a/lib/zip/pass_thru_decompressor.rb +++ b/lib/zip/pass_thru_decompressor.rb @@ -30,8 +30,8 @@ module Zip @read_so_far >= @chars_to_read end - alias_method :eof, :input_finished? - alias_method :eof?, :input_finished? + alias eof input_finished? + alias eof? input_finished? end end