Useless privates removed (#6768)

Merge pull request 6768
This commit is contained in:
Ana María Martínez Gómez 2018-05-19 21:49:54 +02:00 committed by jekyllbot
parent 784f2e2c0d
commit bc84603017
17 changed files with 13 additions and 104 deletions

View File

@ -57,8 +57,6 @@ Lint/UnneededRequireStatement:
Enabled: false Enabled: false
Lint/UnreachableCode: Lint/UnreachableCode:
Severity: error Severity: error
Lint/UselessAccessModifier:
Enabled: false
Lint/Void: Lint/Void:
Enabled: false Enabled: false
Metrics/AbcSize: Metrics/AbcSize:

View File

@ -207,16 +207,12 @@ module Jekyll
@container ||= site.config["collections_dir"] @container ||= site.config["collections_dir"]
end end
private
def read_document(full_path) def read_document(full_path)
doc = Document.new(full_path, :site => site, :collection => self) doc = Document.new(full_path, :site => site, :collection => self)
doc.read doc.read
docs << doc unless doc.data["published"] == false docs << doc unless doc.data["published"] == false
end end
private
def read_static_file(file_path, full_path) def read_static_file(file_path, full_path)
relative_dir = Jekyll.sanitized_path( relative_dir = Jekyll.sanitized_path(
relative_directory, relative_directory,

View File

@ -103,6 +103,7 @@ module Jekyll
# Perform logical validation of CLI options # Perform logical validation of CLI options
private private
def validate_options(opts) def validate_options(opts)
if opts["livereload"] if opts["livereload"]
if opts["detach"] if opts["detach"]
@ -131,9 +132,6 @@ module Jekyll
end end
end end
#
private
# rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/AbcSize
def register_reload_hooks(opts) def register_reload_hooks(opts)
require_relative "serve/live_reload_reactor" require_relative "serve/live_reload_reactor"
@ -171,7 +169,6 @@ module Jekyll
# when we get ready to party, checking for an setting up an error page # when we get ready to party, checking for an setting up an error page
# and making sure our destination exists. # and making sure our destination exists.
private
def setup(destination) def setup(destination)
require_relative "serve/servlet" require_relative "serve/servlet"
@ -186,9 +183,6 @@ module Jekyll
end end
end end
#
private
def webrick_opts(opts) def webrick_opts(opts)
opts = { opts = {
:JekyllOptions => opts, :JekyllOptions => opts,
@ -209,9 +203,6 @@ module Jekyll
opts opts
end end
#
private
def start_up_webrick(opts, destination) def start_up_webrick(opts, destination)
if opts["livereload"] if opts["livereload"]
@reload_reactor.start(opts) @reload_reactor.start(opts)
@ -226,8 +217,6 @@ module Jekyll
end end
# Recreate NondisclosureName under utf-8 circumstance # Recreate NondisclosureName under utf-8 circumstance
private
def file_handler_opts def file_handler_opts
WEBrick::Config::FileHandler.merge({ WEBrick::Config::FileHandler.merge({
:FancyIndexing => true, :FancyIndexing => true,
@ -237,9 +226,6 @@ module Jekyll
}) })
end end
#
private
def server_address(server, options = {}) def server_address(server, options = {})
format_url( format_url(
server.config[:SSLEnable], server.config[:SSLEnable],
@ -249,7 +235,6 @@ module Jekyll
) )
end end
private
def format_url(ssl_enabled, address, port, baseurl = nil) def format_url(ssl_enabled, address, port, baseurl = nil)
format("%<prefix>s://%<address>s:%<port>i%<baseurl>s", { format("%<prefix>s://%<address>s:%<port>i%<baseurl>s", {
:prefix => ssl_enabled ? "https" : "http", :prefix => ssl_enabled ? "https" : "http",
@ -259,9 +244,6 @@ module Jekyll
}) })
end end
#
private
def default_url(opts) def default_url(opts)
config = configuration_from_options(opts) config = configuration_from_options(opts)
format_url( format_url(
@ -271,9 +253,6 @@ module Jekyll
) )
end end
#
private
def launch_browser(server, opts) def launch_browser(server, opts)
address = server_address(server, opts) address = server_address(server, opts)
return system "start", address if Utils::Platforms.windows? return system "start", address if Utils::Platforms.windows?
@ -286,8 +265,6 @@ module Jekyll
# Keep in our area with a thread or detach the server as requested # Keep in our area with a thread or detach the server as requested
# by the user. This method determines what we do based on what you # by the user. This method determines what we do based on what you
# ask us to do. # ask us to do.
private
def boot_or_detach(server, opts) def boot_or_detach(server, opts)
if opts["detach"] if opts["detach"]
pid = Process.fork do pid = Process.fork do
@ -305,8 +282,6 @@ module Jekyll
end end
# Make the stack verbose if the user requests it. # Make the stack verbose if the user requests it.
private
def enable_logging(opts) def enable_logging(opts)
opts[:AccessLog] = [] opts[:AccessLog] = []
level = WEBrick::Log.const_get(opts[:JekyllOptions]["verbose"] ? :DEBUG : :WARN) level = WEBrick::Log.const_get(opts[:JekyllOptions]["verbose"] ? :DEBUG : :WARN)
@ -316,8 +291,6 @@ module Jekyll
# Add SSL to the stack if the user triggers --enable-ssl and they # Add SSL to the stack if the user triggers --enable-ssl and they
# provide both types of certificates commonly needed. Raise if they # provide both types of certificates commonly needed. Raise if they
# forget to add one of the certificates. # forget to add one of the certificates.
private
def enable_ssl(opts) def enable_ssl(opts)
cert, key, src = cert, key, src =
opts[:JekyllOptions].values_at("ssl_cert", "ssl_key", "source") opts[:JekyllOptions].values_at("ssl_cert", "ssl_key", "source")
@ -333,7 +306,6 @@ module Jekyll
opts[:SSLEnable] = true opts[:SSLEnable] = true
end end
private
def start_callback(detached) def start_callback(detached)
unless detached unless detached
proc do proc do
@ -348,7 +320,6 @@ module Jekyll
end end
end end
private
def stop_callback(detached) def stop_callback(detached)
unless detached unless detached
proc do proc do
@ -364,13 +335,11 @@ module Jekyll
end end
end end
private
def mime_types def mime_types
file = File.expand_path("../mime.types", __dir__) file = File.expand_path("../mime.types", __dir__)
WEBrick::HTTPUtils.load_mime_types(file) WEBrick::HTTPUtils.load_mime_types(file)
end end
private
def read_file(source_dir, file_path) def read_file(source_dir, file_path)
File.read(Jekyll.sanitized_path(source_dir, file_path)) File.read(Jekyll.sanitized_path(source_dir, file_path))
end end

View File

@ -81,6 +81,7 @@ module Jekyll
end end
private private
def connect(websocket, handshake) def connect(websocket, handshake)
@connections_count += 1 @connections_count += 1
if @connections_count == 1 if @connections_count == 1
@ -99,12 +100,10 @@ module Jekyll
@websockets << websocket @websockets << websocket
end end
private
def disconnect(websocket) def disconnect(websocket)
@websockets.delete(websocket) @websockets.delete(websocket)
end end
private
def print_message(json_message) def print_message(json_message)
msg = JSON.parse(json_message) msg = JSON.parse(json_message)
# Not sure what the 'url' command even does in LiveReload. The spec is silent # Not sure what the 'url' command even does in LiveReload. The spec is silent
@ -114,7 +113,6 @@ module Jekyll
end end
end end
private
def log_error(error) def log_error(error)
Jekyll.logger.error "LiveReload experienced an error. " \ Jekyll.logger.error "LiveReload experienced an error. " \
"Run with --trace for more information." "Run with --trace for more information."

View File

@ -178,9 +178,8 @@ module Jekyll
end end
# rubocop:enable Naming/MethodName # rubocop:enable Naming/MethodName
#
private private
def validate_and_ensure_charset(_req, res) def validate_and_ensure_charset(_req, res)
key = res.header.keys.grep(%r!content-type!i).first key = res.header.keys.grep(%r!content-type!i).first
typ = res.header[key] typ = res.header[key]
@ -190,9 +189,6 @@ module Jekyll
end end
end end
#
private
def set_defaults def set_defaults
hash_ = @jekyll_opts.fetch("webrick", {}).fetch("headers", {}) hash_ = @jekyll_opts.fetch("webrick", {}).fetch("headers", {})
DEFAULTS.each_with_object(@headers = hash_) do |(key, val), hash| DEFAULTS.each_with_object(@headers = hash_) do |(key, val), hash|

View File

@ -278,6 +278,7 @@ module Jekyll
end end
private private
def style_to_permalink(permalink_style) def style_to_permalink(permalink_style)
case permalink_style.to_sym case permalink_style.to_sym
when :pretty when :pretty
@ -299,14 +300,12 @@ module Jekyll
# file - the file from which the config was extracted # file - the file from which the config was extracted
# #
# Raises an ArgumentError if given config is not a hash # Raises an ArgumentError if given config is not a hash
private
def check_config_is_hash!(extracted_config, file) def check_config_is_hash!(extracted_config, file)
unless extracted_config.is_a?(Hash) unless extracted_config.is_a?(Hash)
raise ArgumentError, "Configuration file: (INVALID) #{file}".yellow raise ArgumentError, "Configuration file: (INVALID) #{file}".yellow
end end
end end
private
def check_auto(config) def check_auto(config)
if config.key?("auto") || config.key?("watch") if config.key?("auto") || config.key?("watch")
Jekyll::Deprecator.deprecation_message "Auto-regeneration can no longer" \ Jekyll::Deprecator.deprecation_message "Auto-regeneration can no longer" \
@ -317,7 +316,6 @@ module Jekyll
end end
end end
private
def check_server(config) def check_server(config)
if config.key?("server") if config.key?("server")
Jekyll::Deprecator.deprecation_message "The 'server' configuration option" \ Jekyll::Deprecator.deprecation_message "The 'server' configuration option" \
@ -327,7 +325,6 @@ module Jekyll
end end
end end
private
def check_pygments(config) def check_pygments(config)
if config.key?("pygments") if config.key?("pygments")
Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" \ Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" \
@ -340,7 +337,6 @@ module Jekyll
end end
end end
private
def check_include_exclude(config) def check_include_exclude(config)
%w(include exclude).each do |option| %w(include exclude).each do |option|
if config[option].is_a?(String) if config[option].is_a?(String)
@ -354,7 +350,6 @@ module Jekyll
end end
end end
private
def check_coderay(config) def check_coderay(config)
if (config["kramdown"] || {}).key?("use_coderay") if (config["kramdown"] || {}).key?("use_coderay")
Jekyll::Deprecator.deprecation_message "Please change 'use_coderay'" \ Jekyll::Deprecator.deprecation_message "Please change 'use_coderay'" \
@ -363,7 +358,6 @@ module Jekyll
end end
end end
private
def check_maruku(config) def check_maruku(config)
if config.fetch("markdown", "kramdown").to_s.casecmp("maruku").zero? if config.fetch("markdown", "kramdown").to_s.casecmp("maruku").zero?
Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " \ Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " \
@ -380,7 +374,6 @@ module Jekyll
# #
# Raises a Jekyll::Errors::InvalidConfigurationError if the config `plugins` # Raises a Jekyll::Errors::InvalidConfigurationError if the config `plugins`
# is a string # is a string
private
def check_plugins(config) def check_plugins(config)
if config.key?("plugins") && config["plugins"].is_a?(String) if config.key?("plugins") && config["plugins"].is_a?(String)
Jekyll.logger.error "Configuration Error:", "You specified the" \ Jekyll.logger.error "Configuration Error:", "You specified the" \

View File

@ -76,6 +76,7 @@ module Jekyll
end end
private private
def custom_processor def custom_processor
converter_name = @config["markdown"] converter_name = @config["markdown"]
if custom_class_allowed?(converter_name) if custom_class_allowed?(converter_name)
@ -90,8 +91,6 @@ module Jekyll
# #
# Returns true if the parser name contains only alphanumeric # Returns true if the parser name contains only alphanumeric
# characters and is defined within Jekyll::Converters::Markdown # characters and is defined within Jekyll::Converters::Markdown
private
def custom_class_allowed?(parser_name) def custom_class_allowed?(parser_name)
parser_name !~ %r![^A-Za-z0-9_]! && self.class.constants.include?( parser_name !~ %r![^A-Za-z0-9_]! && self.class.constants.include?(
parser_name.to_sym parser_name.to_sym

View File

@ -47,6 +47,7 @@ module Jekyll
end end
private private
def make_accessible(hash = @config) def make_accessible(hash = @config)
hash.keys.each do |key| hash.keys.each do |key|
hash[key.to_sym] = hash[key] hash[key.to_sym] = hash[key]
@ -59,8 +60,6 @@ module Jekyll
# config[highlighter] # config[highlighter]
# Where `enable_coderay` is now deprecated because Kramdown # Where `enable_coderay` is now deprecated because Kramdown
# supports Rouge now too. # supports Rouge now too.
private
def highlighter def highlighter
return @highlighter if @highlighter return @highlighter if @highlighter
@ -84,7 +83,6 @@ module Jekyll
end end
end end
private
def strip_coderay_prefix(hash) def strip_coderay_prefix(hash)
hash.each_with_object({}) do |(key, val), hsh| hash.each_with_object({}) do |(key, val), hsh|
cleaned_key = key.to_s.gsub(%r!\Acoderay_!, "") cleaned_key = key.to_s.gsub(%r!\Acoderay_!, "")
@ -102,8 +100,6 @@ module Jekyll
# If our highlighter is CodeRay we go in to merge the CodeRay defaults # If our highlighter is CodeRay we go in to merge the CodeRay defaults
# with your "coderay" key if it's there, deprecating it in the # with your "coderay" key if it's there, deprecating it in the
# process of you using it. # process of you using it.
private
def modernize_coderay_config def modernize_coderay_config
unless @config["coderay"].empty? unless @config["coderay"].empty?
Jekyll::Deprecator.deprecation_message( Jekyll::Deprecator.deprecation_message(

View File

@ -416,6 +416,7 @@ module Jekyll
end end
private private
def merge_categories!(other) def merge_categories!(other)
if other.key?("categories") && !other["categories"].nil? if other.key?("categories") && !other["categories"].nil?
if other["categories"].is_a?(String) if other["categories"].is_a?(String)
@ -425,7 +426,6 @@ module Jekyll
end end
end end
private
def merge_date!(source) def merge_date!(source)
if data.key?("date") if data.key?("date")
data["date"] = Utils.parse_date( data["date"] = Utils.parse_date(
@ -435,7 +435,6 @@ module Jekyll
end end
end end
private
def merge_defaults def merge_defaults
defaults = @site.frontmatter_defaults.all( defaults = @site.frontmatter_defaults.all(
relative_path, relative_path,
@ -444,7 +443,6 @@ module Jekyll
merge_data!(defaults, :source => "front matter defaults") unless defaults.empty? merge_data!(defaults, :source => "front matter defaults") unless defaults.empty?
end end
private
def read_content(opts) def read_content(opts)
self.content = File.read(path, Utils.merged_file_read_opts(site, opts)) self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
if content =~ YAML_FRONT_MATTER_REGEXP if content =~ YAML_FRONT_MATTER_REGEXP
@ -454,7 +452,6 @@ module Jekyll
end end
end end
private
def read_post_data def read_post_data
populate_title populate_title
populate_categories populate_categories
@ -462,7 +459,6 @@ module Jekyll
generate_excerpt generate_excerpt
end end
private
def handle_read_error(error) def handle_read_error(error)
if error.is_a? Psych::SyntaxError if error.is_a? Psych::SyntaxError
Jekyll.logger.error "Error:", "YAML Exception reading #{path}: #{error.message}" Jekyll.logger.error "Error:", "YAML Exception reading #{path}: #{error.message}"
@ -475,7 +471,6 @@ module Jekyll
end end
end end
private
def populate_title def populate_title
if relative_path =~ DATE_FILENAME_MATCHER if relative_path =~ DATE_FILENAME_MATCHER
date, slug, ext = Regexp.last_match.captures date, slug, ext = Regexp.last_match.captures
@ -491,14 +486,12 @@ module Jekyll
data["ext"] ||= ext data["ext"] ||= ext
end end
private
def modify_date(date) def modify_date(date)
if !data["date"] || data["date"].to_i == site.time.to_i if !data["date"] || data["date"].to_i == site.time.to_i
merge_data!({ "date" => date }, :source => "filename") merge_data!({ "date" => date }, :source => "filename")
end end
end end
private
def generate_excerpt def generate_excerpt
if generate_excerpt? if generate_excerpt?
data["excerpt"] ||= Jekyll::Excerpt.new(self) data["excerpt"] ||= Jekyll::Excerpt.new(self)

View File

@ -316,7 +316,6 @@ module Jekyll
.map!(&:last) .map!(&:last)
end end
private
def item_property(item, property) def item_property(item, property)
if item.respond_to?(:to_liquid) if item.respond_to?(:to_liquid)
property.to_s.split(".").reduce(item.to_liquid) do |subvalue, attribute| property.to_s.split(".").reduce(item.to_liquid) do |subvalue, attribute|
@ -329,7 +328,6 @@ module Jekyll
end end
end end
private
def as_liquid(item) def as_liquid(item)
case item case item
when Hash when Hash
@ -353,7 +351,6 @@ module Jekyll
end end
# Parse a string to a Liquid Condition # Parse a string to a Liquid Condition
private
def parse_condition(exp) def parse_condition(exp)
parser = Liquid::Parser.new(exp) parser = Liquid::Parser.new(exp)
left_expr = parser.expression left_expr = parser.expression

View File

@ -81,7 +81,6 @@ module Jekyll
time.strftime("%d #{month_type} %Y") time.strftime("%d #{month_type} %Y")
end end
private
def ordinal(number) def ordinal(number)
return "th" if (11..13).cover?(number) return "th" if (11..13).cover?(number)
@ -93,7 +92,6 @@ module Jekyll
end end
end end
private
def time(input) def time(input)
date = Liquid::Utils.to_date(input) date = Liquid::Utils.to_date(input)
unless date.respond_to?(:to_time) unless date.respond_to?(:to_time)

View File

@ -41,16 +41,15 @@ module Jekyll
end end
private private
def parse_expression(str) def parse_expression(str)
Liquid::Variable.new(str, Liquid::ParseContext.new) Liquid::Variable.new(str, Liquid::ParseContext.new)
end end
private
def groupable?(element) def groupable?(element)
element.respond_to?(:group_by) element.respond_to?(:group_by)
end end
private
def grouped_array(groups) def grouped_array(groups)
groups.each_with_object([]) do |item, array| groups.each_with_object([]) do |item, array|
array << { array << {

View File

@ -165,7 +165,6 @@ module Jekyll
end end
end end
private
def regenerate_page?(document) def regenerate_page?(document)
document.asset_file? || document.data["regenerate"] || document.asset_file? || document.data["regenerate"] ||
source_modified_or_dest_missing?( source_modified_or_dest_missing?(
@ -173,7 +172,6 @@ module Jekyll
) )
end end
private
def regenerate_document?(document) def regenerate_document?(document)
!document.write? || document.data["regenerate"] || !document.write? || document.data["regenerate"] ||
source_modified_or_dest_missing?( source_modified_or_dest_missing?(
@ -181,7 +179,6 @@ module Jekyll
) )
end end
private
def existing_file_modified?(path) def existing_file_modified?(path)
# If one of this file dependencies have been modified, # If one of this file dependencies have been modified,
# set the regeneration bit for both the dependency and the file to true # set the regeneration bit for both the dependency and the file to true

View File

@ -166,11 +166,12 @@ module Jekyll
output output
end end
private
# Checks if the layout specified in the document actually exists # Checks if the layout specified in the document actually exists
# #
# layout - the layout to check # layout - the layout to check
# Returns nothing # Returns nothing
private
def validate_layout(layout) def validate_layout(layout)
if invalid_layout?(layout) if invalid_layout?(layout)
Jekyll.logger.warn( Jekyll.logger.warn(
@ -187,7 +188,6 @@ module Jekyll
# Render layout content into document.output # Render layout content into document.output
# #
# Returns String rendered content # Returns String rendered content
private
def render_layout(output, layout, info) def render_layout(output, layout, info)
payload["content"] = output payload["content"] = output
payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {}) payload["layout"] = Utils.deep_merge_hashes(layout.data, payload["layout"] || {})
@ -200,7 +200,6 @@ module Jekyll
) )
end end
private
def add_regenerator_dependencies(layout) def add_regenerator_dependencies(layout)
return unless document.write? return unless document.write?
site.regenerator.add_dependency( site.regenerator.add_dependency(
@ -212,7 +211,6 @@ module Jekyll
# Set page content to payload and assign pager if document has one. # Set page content to payload and assign pager if document has one.
# #
# Returns nothing # Returns nothing
private
def assign_pages! def assign_pages!
payload["page"] = document.to_liquid payload["page"] = document.to_liquid
payload["paginator"] = if document.respond_to?(:pager) payload["paginator"] = if document.respond_to?(:pager)
@ -223,7 +221,6 @@ module Jekyll
# Set related posts to payload if document is a post. # Set related posts to payload if document is a post.
# #
# Returns nothing # Returns nothing
private
def assign_current_document! def assign_current_document!
payload["site"].current_document = document payload["site"].current_document = document
end end
@ -231,13 +228,11 @@ module Jekyll
# Set highlighter prefix and suffix # Set highlighter prefix and suffix
# #
# Returns nothing # Returns nothing
private
def assign_highlighter_options! def assign_highlighter_options!
payload["highlighter_prefix"] = converters.first.highlighter_prefix payload["highlighter_prefix"] = converters.first.highlighter_prefix
payload["highlighter_suffix"] = converters.first.highlighter_suffix payload["highlighter_suffix"] = converters.first.highlighter_suffix
end end
private
def assign_layout_data! def assign_layout_data!
layout = layouts[document.data["layout"]] layout = layouts[document.data["layout"]]
if layout if layout
@ -245,7 +240,6 @@ module Jekyll
end end
end end
private
def permalink_ext def permalink_ext
document_permalink = document.permalink document_permalink = document.permalink
if document_permalink && !document_permalink.end_with?("/") if document_permalink && !document_permalink.end_with?("/")
@ -254,7 +248,6 @@ module Jekyll
end end
end end
private
def converter_output_ext def converter_output_ext
if output_exts.size == 1 if output_exts.size == 1
output_exts.last output_exts.last
@ -263,14 +256,12 @@ module Jekyll
end end
end end
private
def output_exts def output_exts
@output_exts ||= converters.map do |c| @output_exts ||= converters.map do |c|
c.output_ext(document.extname) c.output_ext(document.extname)
end.compact end.compact
end end
private
def liquid_options def liquid_options
@liquid_options ||= site.config["liquid"] @liquid_options ||= site.config["liquid"]
end end

View File

@ -403,10 +403,11 @@ module Jekyll
@collections_path ||= dir_str.empty? ? source : in_source_dir(dir_str) @collections_path ||= dir_str.empty? ? source : in_source_dir(dir_str)
end end
private
# Limits the current posts; removes the posts which exceed the limit_posts # Limits the current posts; removes the posts which exceed the limit_posts
# #
# Returns nothing # Returns nothing
private
def limit_posts! def limit_posts!
if limit_posts > 0 if limit_posts > 0
limit = posts.docs.length < limit_posts ? posts.docs.length : limit_posts limit = posts.docs.length < limit_posts ? posts.docs.length : limit_posts
@ -418,18 +419,15 @@ module Jekyll
# already exist. # already exist.
# #
# Returns The Cleaner # Returns The Cleaner
private
def site_cleaner def site_cleaner
@site_cleaner ||= Cleaner.new(self) @site_cleaner ||= Cleaner.new(self)
end end
private
def configure_plugins def configure_plugins
self.plugin_manager = Jekyll::PluginManager.new(self) self.plugin_manager = Jekyll::PluginManager.new(self)
self.plugins = plugin_manager.plugins_path self.plugins = plugin_manager.plugins_path
end end
private
def configure_theme def configure_theme
self.theme = nil self.theme = nil
return if config["theme"].nil? return if config["theme"].nil?
@ -444,20 +442,17 @@ module Jekyll
end end
end end
private
def configure_include_paths def configure_include_paths
@includes_load_paths = Array(in_source_dir(config["includes_dir"].to_s)) @includes_load_paths = Array(in_source_dir(config["includes_dir"].to_s))
@includes_load_paths << theme.includes_path if theme && theme.includes_path @includes_load_paths << theme.includes_path if theme && theme.includes_path
end end
private
def configure_file_read_opts def configure_file_read_opts
self.file_read_opts = {} self.file_read_opts = {}
self.file_read_opts[:encoding] = config["encoding"] if config["encoding"] self.file_read_opts[:encoding] = config["encoding"] if config["encoding"]
self.file_read_opts = Jekyll::Utils.merged_file_read_opts(self, {}) self.file_read_opts = Jekyll::Utils.merged_file_read_opts(self, {})
end end
private
def render_docs(payload) def render_docs(payload)
collections.each_value do |collection| collections.each_value do |collection|
collection.docs.each do |document| collection.docs.each do |document|
@ -466,14 +461,12 @@ module Jekyll
end end
end end
private
def render_pages(payload) def render_pages(payload)
pages.flatten.each do |page| pages.flatten.each do |page|
render_regenerated(page, payload) render_regenerated(page, payload)
end end
end end
private
def render_regenerated(document, payload) def render_regenerated(document, payload)
return unless regenerator.regenerate?(document) return unless regenerator.regenerate?(document)
document.output = Jekyll::Renderer.new(self, document, payload).run document.output = Jekyll::Renderer.new(self, document, payload).run

View File

@ -313,6 +313,7 @@ module Jekyll
end end
private private
def merge_values(target, overwrite) def merge_values(target, overwrite)
target.merge!(overwrite) do |_key, old_val, new_val| target.merge!(overwrite) do |_key, old_val, new_val|
if new_val.nil? if new_val.nil?
@ -325,14 +326,12 @@ module Jekyll
end end
end end
private
def merge_default_proc(target, overwrite) def merge_default_proc(target, overwrite)
if target.is_a?(Hash) && overwrite.is_a?(Hash) && target.default_proc.nil? if target.is_a?(Hash) && overwrite.is_a?(Hash) && target.default_proc.nil?
target.default_proc = overwrite.default_proc target.default_proc = overwrite.default_proc
end end
end end
private
def duplicate_frozen_values(target) def duplicate_frozen_values(target)
target.each do |key, val| target.each do |key, val|
target[key] = val.dup if val.frozen? && duplicable?(val) target[key] = val.dup if val.frozen? && duplicable?(val)
@ -343,7 +342,6 @@ module Jekyll
# #
# See Utils#slugify for a description of the character sequence specified # See Utils#slugify for a description of the character sequence specified
# by each mode. # by each mode.
private
def replace_character_sequence_with_hyphen(string, mode: "default") def replace_character_sequence_with_hyphen(string, mode: "default")
replaceable_char = replaceable_char =
case mode case mode

View File

@ -23,8 +23,6 @@ module Jekyll
!dns("example.com").nil? !dns("example.com").nil?
end end
private
module_function
def dns(domain) def dns(domain)
require "resolv" require "resolv"
Resolv::DNS.open do |resolver| Resolv::DNS.open do |resolver|