From 3a04093e5113751bbc4907c01f49412b6f94cbbd Mon Sep 17 00:00:00 2001 From: Brint O'Hearn Date: Mon, 23 May 2016 20:58:28 -0500 Subject: [PATCH] Rubocop cleanup for lib/jekyll/page.rb --- .rubocop.yml | 1 - lib/jekyll/page.rb | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 198cb1e6..0fdff616 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -21,7 +21,6 @@ AllCops: - lib/jekyll/layout.rb - lib/jekyll/liquid_renderer/table.rb - lib/jekyll/liquid_renderer.rb - - lib/jekyll/page.rb - lib/jekyll/plugin_manager.rb - lib/jekyll/reader.rb - lib/jekyll/readers/layout_reader.rb diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index 2bdcdf6f..3f984709 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -9,7 +9,7 @@ module Jekyll alias_method :extname, :ext - FORWARD_SLASH = '/'.freeze + FORWARD_SLASH = "/".freeze # Attributes for Liquid templates ATTRIBUTES_FOR_LIQUID = %w( @@ -18,7 +18,7 @@ module Jekyll name path url - ) + ).freeze # A set of extensions that are considered HTML or HTML-like so we # should not alter them, this includes .xhtml through XHTM5. @@ -27,7 +27,7 @@ module Jekyll .html .xhtml .htm - ) + ).freeze # Initialize a new Page. # @@ -71,7 +71,7 @@ module Jekyll # # Returns the String permalink or nil if none has been set. def permalink - data.nil? ? nil : data['permalink'] + data.nil? ? nil : data["permalink"] end # The template of the permalink. @@ -92,9 +92,9 @@ module Jekyll # Returns the String url. def url @url ||= URL.new({ - :template => template, + :template => template, :placeholders => url_placeholders, - :permalink => permalink + :permalink => permalink }).to_s end @@ -135,7 +135,7 @@ module Jekyll # # Returns the path to the source file def path - data.fetch('path') { relative_path.sub(/\A\//, '') } + data.fetch("path") { relative_path.sub(%r{!\A\/!}, "") } end # The path to the page source file, relative to the site source @@ -167,7 +167,7 @@ module Jekyll # Returns the Boolean of whether this Page is an index file or not. def index? - basename == 'index' + basename == "index" end def trigger_hooks(hook_name, *args)