Skip to content

Commit

Permalink
Style fixes for Rubocop 0.42.0
Browse files Browse the repository at this point in the history
- var == 0 becomes var.zero?
- when defining method_missing, also define respond_to_missing?
  • Loading branch information
parkr committed Jul 25, 2016
1 parent 0e0e9f2 commit 4b69874
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion features/support/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def run_bundle(args)
def run_jekyll(args)
args = args.strip.split(" ") # Shellwords?
process = run_in_shell(Paths.jekyll_bin.to_s, *args, "--trace")
process.exitstatus == 0
process.exitstatus.zero?
end

#
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def docs

# Override of normal respond_to? to match method_missing's logic for
# looking in @data.
def respond_to?(method, include_private = false)
def respond_to_missing?(method, include_private = false)
docs.respond_to?(method.to_sym, include_private) || super
end

Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def check_coderay(config)

private
def check_maruku(config)
if config.fetch("markdown", "kramdown").to_s.casecmp("maruku") == 0
if config.fetch("markdown", "kramdown").to_s.casecmp("maruku").zero?
Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " \
"Markdown processor, which has been removed as of 3.0.0. " \
"We recommend you switch to Kramdown. To do this, replace " \
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def to_s
def <=>(other)
return nil unless other.respond_to?(:data)
cmp = data["date"] <=> other.data["date"]
cmp = path <=> other.path if cmp.nil? || cmp == 0
cmp = path <=> other.path if cmp.nil? || cmp.zero?
cmp
end

Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/drops/document_drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def excerpt
def <=>(other)
return nil unless other.is_a? DocumentDrop
cmp = self["date"] <=> other["date"]
cmp = self["path"] <=> other["path"] if cmp.nil? || cmp == 0
cmp = self["path"] <=> other["path"] if cmp.nil? || cmp.zero?
cmp
end

Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/liquid_renderer/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def generate_row(row_data, widths)
str = ""

row_data.each_with_index do |cell_data, cell_index|
str << if cell_index == 0
str << if cell_index.zero?
cell_data.ljust(widths[cell_index], " ")
else
cell_data.rjust(widths[cell_index], " ")
Expand Down

0 comments on commit 4b69874

Please sign in to comment.