Replace costly Hash#fetch with arity=2 with arity=1 + block.
This commit is contained in:
parent
ab3f27e674
commit
2eb318a929
|
@ -126,7 +126,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(/\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
|
||||||
|
|
|
@ -108,14 +108,14 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns excerpt string.
|
# Returns excerpt string.
|
||||||
def excerpt
|
def excerpt
|
||||||
data.fetch('excerpt', extracted_excerpt.to_s)
|
data.fetch('excerpt') { extracted_excerpt.to_s }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: the Post title, from the YAML Front-Matter or from the slug
|
# Public: the Post title, from the YAML Front-Matter or from the slug
|
||||||
#
|
#
|
||||||
# Returns the post title
|
# Returns the post title
|
||||||
def title
|
def title
|
||||||
data.fetch("title", titleized_slug)
|
data.fetch("title") { titleized_slug }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Turns the post slug into a suitable title
|
# Turns the post slug into a suitable title
|
||||||
|
@ -130,7 +130,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the path to the file relative to the site source
|
# Returns the path to the file relative to the site source
|
||||||
def path
|
def path
|
||||||
data.fetch('path', relative_path.sub(/\A\//, ''))
|
data.fetch('path') { relative_path.sub(/\A\//, '') }
|
||||||
end
|
end
|
||||||
|
|
||||||
# The path to the post source file, relative to the site source
|
# The path to the post source file, relative to the site source
|
||||||
|
|
Loading…
Reference in New Issue