Permalink
Browse files

Style fixes for Rubocop 0.42.0

- var == 0 becomes var.zero?
- when defining method_missing, also define respond_to_missing?
  • Loading branch information...
1 parent 0e0e9f2 commit 4b698747dc15525ad3f544d420835ac4396830fa @parkr parkr committed Jul 25, 2016
@@ -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
#
@@ -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
@@ -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 " \
@@ -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
@@ -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
@@ -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], " ")

0 comments on commit 4b69874

Please sign in to comment.