From 8732bd380ab8c633220187f8c1c443cc0beba088 Mon Sep 17 00:00:00 2001 From: daovy <33154607+daovy@users.noreply.github.com> Date: Fri, 4 Oct 2019 11:19:07 +0700 Subject: [PATCH 1/2] add multiple_add method Adds multiple key/value pairs to the index. --- doc_src/tx.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc_src/tx.rb b/doc_src/tx.rb index ea066be..dc0c507 100644 --- a/doc_src/tx.rb +++ b/doc_src/tx.rb @@ -301,6 +301,12 @@ def scan(str, &block) yield(key, pos, value) end + # Adds multiple key/value pairs to the index. + # + # e.g. builder.add_all(["key1", "value1", "key2", "value2"]) + def multiple_add(words) + Builder.new.add_all(words) + end end end From 55ad7f43e61cf23e94e2e0d47463b7c7a27dad19 Mon Sep 17 00:00:00 2001 From: daovy <33154607+daovy@users.noreply.github.com> Date: Fri, 4 Oct 2019 11:21:32 +0700 Subject: [PATCH 2/2] Revise the return encoding Revise the return encoding for old ruby versions --- lib/tx.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tx.rb b/lib/tx.rb index 7541e61..76c0848 100644 --- a/lib/tx.rb +++ b/lib/tx.rb @@ -50,19 +50,19 @@ def bytesize(str) else def default_encoding - return nil + Encoding::UTF_8 end def add_encoding(obj) - return obj + obj end def to_binary(str) - return str + str end def bytesize(str) - return str.length + str.length end end