Rubocop: Style/HashSyntax

- Use hash rockets syntax
This commit is contained in:
Pat Hawks 2016-01-03 15:49:22 -08:00
parent d157a04c6d
commit 2530a8cdfc
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
9 changed files with 43 additions and 43 deletions

View File

@ -56,7 +56,7 @@ module Jekyll
full_path = collection_dir(file_path) full_path = collection_dir(file_path)
next if File.directory?(full_path) next if File.directory?(full_path)
if Utils.has_yaml_header? full_path if Utils.has_yaml_header? full_path
doc = Jekyll::Document.new(full_path, { site: site, collection: self }) doc = Jekyll::Document.new(full_path, { :site => site, :collection => self })
doc.read doc.read
if site.publisher.publish?(doc) || !write? if site.publisher.publish?(doc) || !write?
docs << doc docs << doc

View File

@ -197,9 +197,9 @@ module Jekyll
# Returns the computed URL for the document. # Returns the computed URL for the document.
def url def url
@url = URL.new({ @url = URL.new({
template: url_template, :template => url_template,
placeholders: url_placeholders, :placeholders => url_placeholders,
permalink: permalink :permalink => permalink
}).to_s }).to_s
end end

View File

@ -19,8 +19,8 @@ module Jekyll
end end
def title def title
Utils.slugify(@obj.data['slug'], mode: "pretty", cased: true) || Utils.slugify(@obj.data['slug'], :mode => "pretty", :cased => true) ||
Utils.slugify(@obj.basename_without_ext, mode: "pretty", cased: true) Utils.slugify(@obj.basename_without_ext, :mode => "pretty", :cased => true)
end end
def slug def slug

View File

@ -45,7 +45,7 @@ module Jekyll
# Returns the given filename or title as a lowercase URL String. # Returns the given filename or title as a lowercase URL String.
# See Utils.slugify for more detail. # See Utils.slugify for more detail.
def slugify(input, mode=nil) def slugify(input, mode=nil)
Utils.slugify(input, mode: mode) Utils.slugify(input, :mode => mode)
end end
# Format a date in short format e.g. "27 Jan 2011". # Format a date in short format e.g. "27 Jan 2011".

View File

@ -4,37 +4,37 @@ module Jekyll
# compatibility layer for octopress-hooks users # compatibility layer for octopress-hooks users
PRIORITY_MAP = { PRIORITY_MAP = {
low: 10, :low => 10,
normal: 20, :normal => 20,
high: 30, :high => 30,
}.freeze }.freeze
# initial empty hooks # initial empty hooks
@registry = { @registry = {
:site => { :site => {
after_reset: [], :after_reset => [],
post_read: [], :post_read => [],
pre_render: [], :pre_render => [],
post_render: [], :post_render => [],
post_write: [], :post_write => [],
}, },
:pages => { :pages => {
post_init: [], :post_init => [],
pre_render: [], :pre_render => [],
post_render: [], :post_render => [],
post_write: [], :post_write => [],
}, },
:posts => { :posts => {
post_init: [], :post_init => [],
pre_render: [], :pre_render => [],
post_render: [], :post_render => [],
post_write: [], :post_write => [],
}, },
:documents => { :documents => {
post_init: [], :post_init => [],
pre_render: [], :pre_render => [],
post_render: [], :post_render => [],
post_write: [], :post_write => [],
}, },
} }
@ -60,10 +60,10 @@ module Jekyll
# register a single hook to be called later, internal API # register a single hook to be called later, internal API
def self.register_one(owner, event, priority, &block) def self.register_one(owner, event, priority, &block)
@registry[owner] ||={ @registry[owner] ||={
post_init: [], :post_init => [],
pre_render: [], :pre_render => [],
post_render: [], :post_render => [],
post_write: [], :post_write => [],
} }
unless @registry[owner][event] unless @registry[owner][event]

View File

@ -53,8 +53,8 @@ module Jekyll
next unless entry =~ matcher next unless entry =~ matcher
path = @site.in_source_dir(File.join(dir, magic_dir, entry)) path = @site.in_source_dir(File.join(dir, magic_dir, entry))
Document.new(path, { Document.new(path, {
site: @site, :site => @site,
collection: @site.posts :collection => @site.posts
}) })
end.reject(&:nil?) end.reject(&:nil?)
end end

View File

@ -43,8 +43,8 @@ module Jekyll
document.trigger_hooks(:pre_render, payload) document.trigger_hooks(:pre_render, payload)
info = { info = {
filters: [Jekyll::Filters], :filters => [Jekyll::Filters],
registers: { :site => site, :page => payload.page } :registers => { :site => site, :page => payload.page }
} }
# render and transform content (this becomes the final content of the object) # render and transform content (this becomes the final content of the object)

View File

@ -104,12 +104,12 @@ module Jekyll
def placeholders def placeholders
{ {
collection: @collection.label, :collection => @collection.label,
path: relative_path[ :path => relative_path[
@collection.relative_directory.size..relative_path.size], @collection.relative_directory.size..relative_path.size],
output_ext: '', :output_ext => '',
name: '', :name => '',
title: '', :title => '',
} }
end end
@ -121,8 +121,8 @@ module Jekyll
relative_path relative_path
else else
::Jekyll::URL.new({ ::Jekyll::URL.new({
template: @collection.url_template, :template => @collection.url_template,
placeholders: placeholders, :placeholders => placeholders,
}) })
end.to_s.gsub /\/$/, '' end.to_s.gsub /\/$/, ''
end end

View File

@ -99,7 +99,7 @@ eos
def render_rouge(code) def render_rouge(code)
Jekyll::External.require_with_graceful_fail('rouge') Jekyll::External.require_with_graceful_fail('rouge')
formatter = Rouge::Formatters::HTML.new(line_numbers: @highlight_options[:linenos], wrap: false) formatter = Rouge::Formatters::HTML.new(:line_numbers => @highlight_options[:linenos], :wrap => false)
lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
formatter.format(lexer.lex(code)) formatter.format(lexer.lex(code))
end end