From 4d08889a7c00ead60107b52cc4ff70d50cc07e7c Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sun, 29 Jun 2014 22:21:47 +0000 Subject: [PATCH] Prefer String#chomp over String#sub --- lib/mutant/ast/node_predicates.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mutant/ast/node_predicates.rb b/lib/mutant/ast/node_predicates.rb index 262acf82..b3143d8d 100644 --- a/lib/mutant/ast/node_predicates.rb +++ b/lib/mutant/ast/node_predicates.rb @@ -6,7 +6,7 @@ module Mutant Types::ALL.each do |type| fail "method: #{type} is already defined" if instance_methods(true).include?(type) - name = "n_#{type.to_s.sub(/\??\z/, '?')}" + name = "n_#{type.to_s.chomp('?')}?" define_method(name) do |node| node.type.equal?(type)