Skip to content

Commit

Permalink
fix rubocop cop Style/ClassCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
ShockwaveNN committed Jun 8, 2015
1 parent 753eab1 commit 8c13dfc
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 21 deletions.
6 changes: 0 additions & 6 deletions .rubocop_rubyzip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ Style/BlockDelimiters:
Style/ClassAndModuleChildren:
Enabled: false

# Offense count: 15
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassCheck:
Enabled: false

# Offense count: 77
Style/Documentation:
Enabled: false
Expand Down
4 changes: 2 additions & 2 deletions lib/zip/central_directory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def entries

def initialize(entries = EntrySet.new, comment = '') #:nodoc:
super()
@entry_set = entries.kind_of?(EntrySet) ? entries : EntrySet.new(entries)
@entry_set = entries.is_a?(EntrySet) ? entries : EntrySet.new(entries)
@comment = comment
end

Expand Down Expand Up @@ -197,7 +197,7 @@ def self.read_from_stream(io) #:nodoc:
end

def ==(other) #:nodoc:
return false unless other.kind_of?(CentralDirectory)
return false unless other.is_a?(CentralDirectory)
@entry_set.entries.sort == other.entries.sort && comment == other.comment
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/zip/entry_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def dup
end

def ==(other)
return false unless other.kind_of?(EntrySet)
return false unless other.is_a?(EntrySet)
@entry_set.values == other.entry_set.values
end

Expand Down
4 changes: 2 additions & 2 deletions lib/zip/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def get_input_stream(entry, &aProc)
# File.open method.
def get_output_stream(entry, permission_int = nil, comment = nil, extra = nil, compressed_size = nil, crc = nil, compression_method = nil, size = nil, time = nil, &aProc)
new_entry =
if entry.kind_of?(Entry)
if entry.is_a?(Entry)
entry
else
Entry.new(@name, entry.to_s, comment, extra, compressed_size, crc, compression_method, size, time)
Expand Down Expand Up @@ -264,7 +264,7 @@ def read(entry)
def add(entry, src_path, &continue_on_exists_proc)
continue_on_exists_proc ||= proc { ::Zip.continue_on_exists_proc }
check_entry_exists(entry, continue_on_exists_proc, 'add')
new_entry = entry.kind_of?(::Zip::Entry) ? entry : ::Zip::Entry.new(@name, entry.to_s)
new_entry = entry.is_a?(::Zip::Entry) ? entry : ::Zip::Entry.new(@name, entry.to_s)
new_entry.gather_fileinfo_from_srcpath(src_path)
new_entry.dirty = true
@entry_set << new_entry
Expand Down
2 changes: 1 addition & 1 deletion lib/zip/output_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def close_buffer
# +entry+ can be a ZipEntry object or a string.
def put_next_entry(entry_name, comment = nil, extra = nil, compression_method = Entry::DEFLATED, level = Zip.default_compression)
raise Error, 'zip stream is closed' if @closed
if entry_name.kind_of?(Entry)
if entry_name.is_a?(Entry)
new_entry = entry_name
else
new_entry = Entry.new(@file_name, entry_name.to_s)
Expand Down
2 changes: 1 addition & 1 deletion test/filesystem/file_nonmutating_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def test_readlink

def test_stat
s = @zip_file.file.stat('file1')
assert(s.kind_of?(File::Stat)) # It pretends
assert(s.is_a?(File::Stat)) # It pretends
assert_raises(Errno::ENOENT, 'No such file or directory - noSuchFile') do
@zip_file.file.stat('noSuchFile')
end
Expand Down
10 changes: 5 additions & 5 deletions test/ioextras/fake_io_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ class FakeIOUsingClass
def test_kind_of?
obj = FakeIOUsingClass.new

assert(obj.kind_of?(Object))
assert(obj.kind_of?(FakeIOUsingClass))
assert(obj.kind_of?(IO))
assert(!obj.kind_of?(Fixnum))
assert(!obj.kind_of?(String))
assert(obj.is_a?(Object))
assert(obj.is_a?(FakeIOUsingClass))
assert(obj.is_a?(IO))
assert(!obj.is_a?(Fixnum))
assert(!obj.is_a?(String))
end
end
6 changes: 3 additions & 3 deletions test/output_stream_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def test_cannot_open_file
begin
::Zip::OutputStream.open(name)
rescue Exception
assert($!.kind_of?(Errno::EISDIR) || # Linux
$!.kind_of?(Errno::EEXIST) || # Windows/cygwin
$!.kind_of?(Errno::EACCES), # Windows
assert($!.is_a?(Errno::EISDIR) || # Linux
$!.is_a?(Errno::EEXIST) || # Windows/cygwin
$!.is_a?(Errno::EACCES), # Windows
"Expected Errno::EISDIR (or on win/cygwin: Errno::EEXIST), but was: #{$!.class}")
end
end
Expand Down

0 comments on commit 8c13dfc

Please sign in to comment.