Skip to content

Commit

Permalink
Attain Ruby 3.0 compatibility (jekyll#7948)
Browse files Browse the repository at this point in the history
Merge pull request 7948
  • Loading branch information
ashmaroli authored Jan 31, 2020
1 parent 5be7faa commit 389eb88
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ Style/Alias:
EnforcedStyle: prefer_alias_method
Style/AndOr:
Severity: error
Style/BracesAroundHashParameters:
Enabled: false
Style/ClassAndModuleChildren:
Exclude:
- test/**/*.rb
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ matrix:
- rvm: *ruby1
env: TEST_SUITE=profile-docs
name: "Profile Docs"
- rvm: *ruby1
- rvm: *ruby2
env: TEST_SUITE=memprof
name: "Profile Memory Allocation"
exclude:
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/convertible.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def read_yaml(base, name, opts = {})

begin
self.content = File.read(@path || site.in_source_dir(base, name),
Utils.merged_file_read_opts(site, opts))
**Utils.merged_file_read_opts(site, opts))
if content =~ Document::YAML_FRONT_MATTER_REGEXP
self.content = $POSTMATCH
self.data = SafeYAML.load(Regexp.last_match(1))
Expand Down
10 changes: 5 additions & 5 deletions lib/jekyll/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def read(opts = {})
else
begin
merge_defaults
read_content(opts)
read_content(**opts)
read_post_data
rescue StandardError => e
handle_read_error(e)
Expand Down Expand Up @@ -429,14 +429,14 @@ def populate_categories
categories.flatten!
categories.uniq!

merge_data!("categories" => categories)
merge_data!({ "categories" => categories })
end

def populate_tags
tags = Utils.pluralized_array_from_hash(data, "tag", "tags")
tags.flatten!

merge_data!("tags" => tags)
merge_data!({ "tags" => tags })
end

private
Expand All @@ -462,8 +462,8 @@ def merge_defaults
merge_data!(defaults, :source => "front matter defaults") unless defaults.empty?
end

def read_content(opts)
self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
def read_content(**opts)
self.content = File.read(path, **Utils.merged_file_read_opts(site, opts))
if content =~ YAML_FRONT_MATTER_REGEXP
self.content = $POSTMATCH
data_file = SafeYAML.load(Regexp.last_match(1))
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/tags/include.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def realpath_prefixed_with?(path, dir)

# This method allows to modify the file content by inheriting from the class.
def read_file(file, context)
File.read(file, file_read_opts(context))
File.read(file, **file_read_opts(context))
end

private
Expand Down

0 comments on commit 389eb88

Please sign in to comment.