Skip to content

Commit 7058c59

Browse files
committed
Remove extra existence checks
1 parent 48b7d89 commit 7058c59

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

lib/sassc/embedded.rb

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ def try_path_with_ext(path)
258258
def try_path(path)
259259
partial = File.join(File.dirname(path), "_#{File.basename(path)}")
260260
result = []
261-
result.push(partial) if file_exist?(partial)
262-
result.push(path) if file_exist?(path)
261+
result.push(partial) if File.file?(partial)
262+
result.push(path) if File.file?(path)
263263
result
264264
end
265265

266266
def try_path_as_dir(path, from_import)
267-
return unless dir_exist?(path)
267+
return unless File.directory?(path)
268268

269269
if from_import
270270
result = exactly_one(try_path_with_ext(File.join(path, 'index.import')))
@@ -281,14 +281,6 @@ def exactly_one(paths)
281281
raise "It's not clear which file to import. Found:\n#{paths.map { |path| " #{path}" }.join("\n")}"
282282
end
283283

284-
def file_exist?(path)
285-
File.exist?(path) && File.file?(path)
286-
end
287-
288-
def dir_exist?(path)
289-
File.exist?(path) && File.directory?(path)
290-
end
291-
292284
def without_ext(path)
293285
ext = File.extname(path)
294286
path.delete_suffix(ext)

0 commit comments

Comments
 (0)