Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
simonoff committed May 14, 2015
1 parent 7fddb7c commit d3079f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions lib/roo/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class Roo::Base
include Enumerable

TEMP_PREFIX = 'roo_'
TEMP_PREFIX = 'roo_'.freeze
MAX_ROW_COL = 999_999.freeze
MIN_ROW_COL = 0.freeze

Expand Down Expand Up @@ -38,7 +38,8 @@ def initialize(filename, options = {}, _file_warning = :error, _tmpdir = nil)
end

def close
@tmpdirs.nil? or @tmpdirs.each { |dir| FileUtils.remove_entry dir }
return nil unless @tmpdirs
@tmpdirs.each { |dir| ::FileUtils.remove_entry(dir) }
nil
end

Expand Down Expand Up @@ -443,7 +444,7 @@ def is_stream?(filename_or_stream)

private

def track_tmpdir! tmpdir
def track_tmpdir!(tmpdir)
(@tmpdirs ||= []) << tmpdir
end

Expand Down Expand Up @@ -533,8 +534,8 @@ def make_tmpdir(prefix = nil, root = nil, &block)
else
TEMP_PREFIX
end
Dir.mktmpdir(prefix, root || ENV['ROO_TMP'], &block).tap do |result|
block_given? or track_tmpdir! result
::Dir.mktmpdir(prefix, root || ENV['ROO_TMP'], &block).tap do |result|
block_given? || track_tmpdir!(result)
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_roo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2074,7 +2074,7 @@ def test_open_stream

def test_close
with_each_spreadsheet(:name=>'numbers1') do |oo|
next unless tempdir = oo.instance_variable_get('@tmpdir')
next unless (tempdir = oo.instance_variable_get('@tmpdir'))
oo.close
assert !File.exists?(tempdir), "Expected #{tempdir} to be cleaned up, but it still exists"
end
Expand Down

0 comments on commit d3079f7

Please sign in to comment.