Rubocop cleanup for lib/jekyll/page.rb

This commit is contained in:
Brint O'Hearn 2016-05-23 20:58:28 -05:00 committed by Pat Hawks
parent 733c56a65e
commit 3a04093e51
2 changed files with 8 additions and 9 deletions

View File

@ -21,7 +21,6 @@ AllCops:
- lib/jekyll/layout.rb - lib/jekyll/layout.rb
- lib/jekyll/liquid_renderer/table.rb - lib/jekyll/liquid_renderer/table.rb
- lib/jekyll/liquid_renderer.rb - lib/jekyll/liquid_renderer.rb
- lib/jekyll/page.rb
- lib/jekyll/plugin_manager.rb - lib/jekyll/plugin_manager.rb
- lib/jekyll/reader.rb - lib/jekyll/reader.rb
- lib/jekyll/readers/layout_reader.rb - lib/jekyll/readers/layout_reader.rb

View File

@ -9,7 +9,7 @@ module Jekyll
alias_method :extname, :ext alias_method :extname, :ext
FORWARD_SLASH = '/'.freeze FORWARD_SLASH = "/".freeze
# Attributes for Liquid templates # Attributes for Liquid templates
ATTRIBUTES_FOR_LIQUID = %w( ATTRIBUTES_FOR_LIQUID = %w(
@ -18,7 +18,7 @@ module Jekyll
name name
path path
url url
) ).freeze
# A set of extensions that are considered HTML or HTML-like so we # A set of extensions that are considered HTML or HTML-like so we
# should not alter them, this includes .xhtml through XHTM5. # should not alter them, this includes .xhtml through XHTM5.
@ -27,7 +27,7 @@ module Jekyll
.html .html
.xhtml .xhtml
.htm .htm
) ).freeze
# Initialize a new Page. # Initialize a new Page.
# #
@ -71,7 +71,7 @@ module Jekyll
# #
# Returns the String permalink or nil if none has been set. # Returns the String permalink or nil if none has been set.
def permalink def permalink
data.nil? ? nil : data['permalink'] data.nil? ? nil : data["permalink"]
end end
# The template of the permalink. # The template of the permalink.
@ -92,9 +92,9 @@ module Jekyll
# Returns the String url. # Returns the String url.
def url def url
@url ||= URL.new({ @url ||= URL.new({
:template => template, :template => template,
:placeholders => url_placeholders, :placeholders => url_placeholders,
:permalink => permalink :permalink => permalink
}).to_s }).to_s
end end
@ -135,7 +135,7 @@ module Jekyll
# #
# Returns the path to the source file # Returns the path to the source file
def path def path
data.fetch('path') { relative_path.sub(/\A\//, '') } data.fetch("path") { relative_path.sub(%r{!\A\/!}, "") }
end end
# The path to the page source file, relative to the site source # 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. # Returns the Boolean of whether this Page is an index file or not.
def index? def index?
basename == 'index' basename == "index"
end end
def trigger_hooks(hook_name, *args) def trigger_hooks(hook_name, *args)