From b04e3d3de760e8674ad50512f4705042e4b322c8 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 2 May 2019 00:24:18 +0530 Subject: [PATCH] Store list of expected extnames in a constant (#7638) Merge pull request 7638 --- lib/jekyll/convertible.rb | 2 +- lib/jekyll/document.rb | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 863fa4eb..35f6b0f4 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -146,7 +146,7 @@ module Jekyll # # Returns true if extname == .sass or .scss, false otherwise. def sass_file? - %w(.sass .scss).include?(ext) + Jekyll::Document::SASS_FILE_EXTS.include?(ext) end # Determine whether the document is a CoffeeScript file. diff --git a/lib/jekyll/document.rb b/lib/jekyll/document.rb index a8fda1e8..7e9e42ca 100644 --- a/lib/jekyll/document.rb +++ b/lib/jekyll/document.rb @@ -14,6 +14,9 @@ module Jekyll DATELESS_FILENAME_MATCHER = %r!^(?:.+/)*(.*)(\.[^.]+)$!.freeze DATE_FILENAME_MATCHER = %r!^(?>.+/)*?(\d{2,4}-\d{1,2}-\d{1,2})-([^/]*)(\.[^.]+)$!.freeze + SASS_FILE_EXTS = %w(.sass .scss).freeze + YAML_FILE_EXTS = %w(.yaml .yml).freeze + # Create a new Document. # # path - the path to the file @@ -138,7 +141,7 @@ module Jekyll # # Returns true if the extname is either .yml or .yaml, false otherwise. def yaml_file? - %w(.yaml .yml).include?(extname) + YAML_FILE_EXTS.include?(extname) end # Determine whether the document is an asset file. @@ -154,7 +157,7 @@ module Jekyll # # Returns true if extname == .sass or .scss, false otherwise. def sass_file? - %w(.sass .scss).include?(extname) + SASS_FILE_EXTS.include?(extname) end # Determine whether the document is a CoffeeScript file.