Rubocop: Style/EmptyLiteral

- Use array literal [] instead of Array.new
 - Use hash literal {} instead of Hash.new
This commit is contained in:
Pat Hawks 2016-01-03 14:39:01 -08:00
parent ffdbeb89dd
commit 31dd0ebed5
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
7 changed files with 10 additions and 10 deletions

View File

@ -95,7 +95,7 @@ module Jekyll
# list of option names and their defaults.
#
# Returns the final configuration Hash.
def configuration(override = Hash.new)
def configuration(override = {})
config = Configuration[Configuration::DEFAULTS]
override = Configuration[override].stringify_keys
unless override.delete('skip_config_files')

View File

@ -76,7 +76,7 @@ module Jekyll
# Returns an Array of file paths to the documents in this collection
# relative to the collection's directory
def entries
return Array.new unless exists?
return [] unless exists?
@entries ||=
Utils.safe_glob(collection_dir, ["**", "*.*"]).map do |entry|
entry["#{collection_dir}/"] = ''; entry
@ -88,7 +88,7 @@ module Jekyll
#
# Returns a list of filtered entry paths.
def filtered_entries
return Array.new unless exists?
return [] unless exists?
@filtered_entries ||=
Dir.chdir(directory) do
entry_filter.filter(entries).reject do |f|
@ -195,7 +195,7 @@ module Jekyll
# Returns the metadata for this collection
def extract_metadata
if site.config['collections'].is_a?(Hash)
site.config['collections'][label] || Hash.new
site.config['collections'][label] || {}
else
{}
end

View File

@ -105,7 +105,7 @@ module Jekyll
end
def case_insensitive_urls(things, destination)
things.inject(Hash.new) do |memo, thing|
things.inject({}) do |memo, thing|
dest = thing.destination(destination)
(memo[dest.downcase] ||= []) << dest
memo

View File

@ -52,7 +52,7 @@ module Jekyll
# Returns a Hash containing the data. An empty hash is returned if
# no data was read.
def data
@data ||= Hash.new
@data ||= {}
end
# Merge some data in with this document's data.

View File

@ -4,7 +4,7 @@ module Jekyll
def initialize(site, dir)
@site = site
@dir = dir
@unfiltered_content = Array.new
@unfiltered_content = []
end
# Read all the files in <source>/<dir>/ for Yaml header and create a new Page

View File

@ -4,7 +4,7 @@ module Jekyll
def initialize(site, dir)
@site = site
@dir = dir
@unfiltered_content = Array.new
@unfiltered_content = []
end
# Read all the files in <source>/<dir>/ for Yaml header and create a new Page

View File

@ -1,7 +1,7 @@
module Jekyll
class StaticFile
# The cache of last modification times [path] -> mtime.
@@mtimes = Hash.new
@@mtimes = {}
attr_reader :relative_path, :extname
@ -90,7 +90,7 @@ module Jekyll
#
# Returns nothing.
def self.reset_cache
@@mtimes = Hash.new
@@mtimes = {}
nil
end