Rubocop: Style/EmptyLiteral
- Use array literal [] instead of Array.new - Use hash literal {} instead of Hash.new
This commit is contained in:
parent
ffdbeb89dd
commit
31dd0ebed5
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue