mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Prefer String#<< over += when possible
This commit is contained in:
parent
8354eef965
commit
5a1b681253
2 changed files with 10 additions and 10 deletions
|
@ -31,22 +31,22 @@ module Capybara
|
|||
def split(css)
|
||||
selectors = []
|
||||
StringIO.open(css.to_s) do |str|
|
||||
selector = ''
|
||||
selector = +''
|
||||
while (char = str.getc)
|
||||
case char
|
||||
when '['
|
||||
selector += parse_square(str)
|
||||
selector << parse_square(str)
|
||||
when '('
|
||||
selector += parse_paren(str)
|
||||
selector << parse_paren(str)
|
||||
when '"', "'"
|
||||
selector += parse_string(char, str)
|
||||
selector << parse_string(char, str)
|
||||
when '\\'
|
||||
selector += char + str.getc
|
||||
selector << char + str.getc
|
||||
when ','
|
||||
selectors << selector.strip
|
||||
selector = ''
|
||||
selector.clear
|
||||
else
|
||||
selector += char
|
||||
selector << char
|
||||
end
|
||||
end
|
||||
selectors << selector.strip
|
||||
|
|
|
@ -40,9 +40,9 @@ module Capybara
|
|||
def description(node_filters: true, expression_filters: true, **options)
|
||||
opts = options_with_defaults(options)
|
||||
description = +''
|
||||
description += undeclared_descriptions.map { |desc| desc.call(opts).to_s }.join
|
||||
description += expression_filter_descriptions.map { |desc| desc.call(opts).to_s }.join if expression_filters
|
||||
description += node_filter_descriptions.map { |desc| desc.call(opts).to_s }.join if node_filters
|
||||
description << undeclared_descriptions.map { |desc| desc.call(opts).to_s }.join
|
||||
description << expression_filter_descriptions.map { |desc| desc.call(opts).to_s }.join if expression_filters
|
||||
description << node_filter_descriptions.map { |desc| desc.call(opts).to_s }.join if node_filters
|
||||
description
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue