diff --git a/lib/tire/index.rb b/lib/tire/index.rb index 904c994c..7f7850a6 100644 --- a/lib/tire/index.rb +++ b/lib/tire/index.rb @@ -93,7 +93,7 @@ def put_mapping(type, mapping) end url = "#{self.url}/#{type}/_mapping" - url += "?#{params.to_param}" unless params.empty? + url << "?#{params.to_param}" unless params.empty? payload = { type => mapping }.to_json @@ -382,7 +382,7 @@ def update(type, id, payload={}, options={}) type = Utils.escape(type) url = "#{self.url}/#{type}/#{Utils.escape(id)}/_update" - url += "?#{options.to_param}" unless options.keys.empty? + url << "?#{options.to_param}" unless options.keys.empty? @response = Configuration.client.post url, MultiJson.encode(payload) MultiJson.decode(@response.body) diff --git a/lib/tire/logger.rb b/lib/tire/logger.rb index 02773d2d..6bb53e7e 100644 --- a/lib/tire/logger.rb +++ b/lib/tire/logger.rb @@ -26,11 +26,11 @@ def log_request(endpoint, params=nil, curl='') # curl -X POST .... # content = "# #{time}" - content += " [#{endpoint}]" - content += " (#{params.inspect})" if params - content += "\n#\n" - content += curl - content += "\n\n" + content << " [#{endpoint}]" + content << " (#{params.inspect})" if params + content << "\n#\n" + content << curl + content << "\n\n" write content end @@ -44,11 +44,11 @@ def log_response(status, took=nil, json='') # } # content = "# #{time}" - content += " [#{status}]" - content += " (#{took} msec)" if took - content += "\n#\n" unless json.to_s !~ /\S/ - json.to_s.each_line { |line| content += "# #{line}" } unless json.to_s !~ /\S/ - content += "\n\n" + content << " [#{status}]" + content << " (#{took} msec)" if took + content << "\n#\n" unless json.to_s !~ /\S/ + json.to_s.each_line { |line| content << "# #{line}" } unless json.to_s !~ /\S/ + content << "\n\n" write content end diff --git a/test/integration/reindex_test.rb b/test/integration/reindex_test.rb index 38075df5..0294ae3e 100644 --- a/test/integration/reindex_test.rb +++ b/test/integration/reindex_test.rb @@ -41,7 +41,7 @@ class ReindexIntegrationTest < Test::Unit::TestCase should "transform documents with a passed lambda" do Tire.index('reindex-test').reindex 'reindex-test-new', transform: lambda { |document| - document[:title] += 'UPDATED' + document[:title] << 'UPDATED' document } diff --git a/test/unit/logger_test.rb b/test/unit/logger_test.rb index ccf75387..ee6b5826 100644 --- a/test/unit/logger_test.rb +++ b/test/unit/logger_test.rb @@ -105,9 +105,9 @@ class LoggerTest < Test::Unit::TestCase # 2011-03-19 11:00:00:000 [200 OK] (4 msec) # log; - # log += json.split.map { |line| "# #{line}" }.join("\n") - json.each_line { |line| log += "# #{line}" } - log += "\n\n" + # log << json.split.map { |line| "# #{line}" }.join("\n") + json.each_line { |line| log << "# #{line}" } + log << "\n\n" @logger.expects(:write).with do |payload| payload =~ Regexp.new( Regexp.escape('2011-03-19 11:00:00') ) payload =~ Regexp.new( Regexp.escape('[200 OK]') )