Enforce consistent emtpy lines and trailing whitespaces in Ruby code
diff --git a/lib/rb/.rubocop.yml b/lib/rb/.rubocop.yml
index 926edcb..c7eb04f 100644
--- a/lib/rb/.rubocop.yml
+++ b/lib/rb/.rubocop.yml
@@ -11,3 +11,15 @@
Layout/IndentationConsistency:
Enabled: true
+
+Layout/EmptyLines:
+ Enabled: true
+
+Layout/LeadingEmptyLines:
+ Enabled: true
+
+Layout/TrailingEmptyLines:
+ Enabled: true
+
+Layout/TrailingWhitespace:
+ Enabled: true
diff --git a/lib/rb/lib/thrift/exceptions.rb b/lib/rb/lib/thrift/exceptions.rb
index 68cb9e0..76d93ff 100644
--- a/lib/rb/lib/thrift/exceptions.rb
+++ b/lib/rb/lib/thrift/exceptions.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
module Thrift
class Exception < StandardError
diff --git a/lib/rb/lib/thrift/multiplexed_processor.rb b/lib/rb/lib/thrift/multiplexed_processor.rb
index c734c04..1a24083 100644
--- a/lib/rb/lib/thrift/multiplexed_processor.rb
+++ b/lib/rb/lib/thrift/multiplexed_processor.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -24,11 +24,11 @@
def initialize
@actual_processors = {}
end
-
+
def register_processor(service_name, processor)
@actual_processors[service_name] = processor
end
-
+
def process(iprot, oprot)
name, type, seqid = iprot.read_message_begin
check_type(type)
@@ -63,7 +63,7 @@
class StoredMessageProtocol < BaseProtocol
include ProtocolDecorator
-
+
def initialize(protocol, message_begin)
super(protocol)
@message_begin = message_begin
diff --git a/lib/rb/lib/thrift/processor.rb b/lib/rb/lib/thrift/processor.rb
index ce21e12..e4c827a 100644
--- a/lib/rb/lib/thrift/processor.rb
+++ b/lib/rb/lib/thrift/processor.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
require 'logger'
diff --git a/lib/rb/lib/thrift/protocol/binary_protocol.rb b/lib/rb/lib/thrift/protocol/binary_protocol.rb
index 39b72ff..ace763c 100644
--- a/lib/rb/lib/thrift/protocol/binary_protocol.rb
+++ b/lib/rb/lib/thrift/protocol/binary_protocol.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,23 +6,23 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
module Thrift
class BinaryProtocol < BaseProtocol
VERSION_MASK = 0xffff0000
VERSION_1 = 0x80010000
TYPE_MASK = 0x000000ff
-
+
attr_reader :strict_read, :strict_write
def initialize(trans, strict_read=true, strict_write=true)
@@ -36,7 +36,7 @@
end
def write_message_begin(name, type, seqid)
- # this is necessary because we added (needed) bounds checking to
+ # this is necessary because we added (needed) bounds checking to
# write_i32, and 0x80010000 is too big for that.
if strict_write
write_i16(VERSION_1 >> 16)
@@ -252,7 +252,7 @@
def get_protocol(trans)
return Thrift::BinaryProtocol.new(trans)
end
-
+
def to_s
"binary"
end
diff --git a/lib/rb/lib/thrift/protocol/binary_protocol_accelerated.rb b/lib/rb/lib/thrift/protocol/binary_protocol_accelerated.rb
index 09b0264..648d016 100644
--- a/lib/rb/lib/thrift/protocol/binary_protocol_accelerated.rb
+++ b/lib/rb/lib/thrift/protocol/binary_protocol_accelerated.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,20 +6,20 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
=begin
The only change required for a transport to support BinaryProtocolAccelerated is to implement 2 methods:
- * borrow(size), which takes an optional argument and returns atleast _size_ bytes from the transport,
+ * borrow(size), which takes an optional argument and returns atleast _size_ bytes from the transport,
or the default buffer size if no argument is given
* consume!(size), which removes size bytes from the front of the buffer
diff --git a/lib/rb/lib/thrift/protocol/compact_protocol.rb b/lib/rb/lib/thrift/protocol/compact_protocol.rb
index bc342e1..36b5538 100644
--- a/lib/rb/lib/thrift/protocol/compact_protocol.rb
+++ b/lib/rb/lib/thrift/protocol/compact_protocol.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
module Thrift
class CompactProtocol < BaseProtocol
@@ -29,9 +29,9 @@
TSTOP = [nil, Types::STOP, 0]
- #
+ #
# All of the on-wire type codes.
- #
+ #
class CompactTypes
BOOLEAN_TRUE = 0x01
BOOLEAN_FALSE = 0x02
@@ -50,7 +50,7 @@
def self.is_bool_type?(b)
(b & 0x0f) == BOOLEAN_TRUE || (b & 0x0f) == BOOLEAN_FALSE
end
-
+
COMPACT_TO_TTYPE = {
Types::STOP => Types::STOP,
BOOLEAN_FALSE => Types::BOOL,
@@ -83,13 +83,13 @@
Types::STRUCT => STRUCT,
Types::UUID => UUID
}
-
+
def self.get_ttype(compact_type)
val = COMPACT_TO_TTYPE[compact_type & 0x0f]
raise "don't know what type: #{compact_type & 0x0f}" unless val
val
end
-
+
def self.get_compact_type(ttype)
val = TTYPE_TO_COMPACT[ttype]
raise "don't know what type: #{ttype & 0x0f}" unless val
@@ -135,14 +135,14 @@
nil
end
- #
- # The workhorse of writeFieldBegin. It has the option of doing a
- # 'type override' of the type header. This is used specifically in the
+ #
+ # The workhorse of writeFieldBegin. It has the option of doing a
+ # 'type override' of the type header. This is used specifically in the
# boolean field case.
- #
+ #
def write_field_begin_internal(type, id, type_override=nil)
last_id = @last_field.pop
-
+
# if there's a type override, use that.
typeToWrite = type_override || CompactTypes.get_compact_type(type)
@@ -408,11 +408,11 @@
end
end
end
-
+
def read_varint32()
read_varint64()
end
-
+
def read_varint64()
shift = 0
result = 0
@@ -424,20 +424,20 @@
end
result
end
-
+
def int_to_zig_zag(n)
(n << 1) ^ (n >> 31)
end
-
+
def long_to_zig_zag(l)
# puts "zz encoded #{l} to #{(l << 1) ^ (l >> 63)}"
(l << 1) ^ (l >> 63)
end
-
+
def zig_zag_to_int(n)
(n >> 1) ^ -(n & 1)
end
-
+
def zig_zag_to_long(n)
(n >> 1) ^ -(n & 1)
end
@@ -447,7 +447,7 @@
def get_protocol(trans)
CompactProtocol.new(trans)
end
-
+
def to_s
"compact"
end
diff --git a/lib/rb/lib/thrift/protocol/multiplexed_protocol.rb b/lib/rb/lib/thrift/protocol/multiplexed_protocol.rb
index b4428a7..ac8333e 100644
--- a/lib/rb/lib/thrift/protocol/multiplexed_protocol.rb
+++ b/lib/rb/lib/thrift/protocol/multiplexed_protocol.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -34,9 +34,9 @@
@protocol.write_message_begin("#{@service_name}:#{name}", type, seqid)
else
@protocol.write_message_begin(name, type, seqid)
- end
+ end
end
-
+
def to_s
"multiplexed(#{@service_name=@protocol.to_s})"
end
diff --git a/lib/rb/lib/thrift/protocol/protocol_decorator.rb b/lib/rb/lib/thrift/protocol/protocol_decorator.rb
index 73571f7..d5bb4ae 100644
--- a/lib/rb/lib/thrift/protocol/protocol_decorator.rb
+++ b/lib/rb/lib/thrift/protocol/protocol_decorator.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
diff --git a/lib/rb/lib/thrift/serializer/deserializer.rb b/lib/rb/lib/thrift/serializer/deserializer.rb
index d2ee325..6d8adff 100644
--- a/lib/rb/lib/thrift/serializer/deserializer.rb
+++ b/lib/rb/lib/thrift/serializer/deserializer.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
module Thrift
class Deserializer
@@ -30,4 +30,4 @@
base
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/rb/lib/thrift/serializer/serializer.rb b/lib/rb/lib/thrift/serializer/serializer.rb
index 2231639..3a42890 100644
--- a/lib/rb/lib/thrift/serializer/serializer.rb
+++ b/lib/rb/lib/thrift/serializer/serializer.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
module Thrift
class Serializer
@@ -31,4 +31,3 @@
end
end
end
-
diff --git a/lib/rb/lib/thrift/server/base_server.rb b/lib/rb/lib/thrift/server/base_server.rb
index aa4d09c..238d9d7 100644
--- a/lib/rb/lib/thrift/server/base_server.rb
+++ b/lib/rb/lib/thrift/server/base_server.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
diff --git a/lib/rb/lib/thrift/server/mongrel_http_server.rb b/lib/rb/lib/thrift/server/mongrel_http_server.rb
index de354c8..0b3832c 100644
--- a/lib/rb/lib/thrift/server/mongrel_http_server.rb
+++ b/lib/rb/lib/thrift/server/mongrel_http_server.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
require 'mongrel'
diff --git a/lib/rb/lib/thrift/server/nonblocking_server.rb b/lib/rb/lib/thrift/server/nonblocking_server.rb
index 740f341..4c2769f 100644
--- a/lib/rb/lib/thrift/server/nonblocking_server.rb
+++ b/lib/rb/lib/thrift/server/nonblocking_server.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
require 'logger'
require 'thread'
@@ -97,7 +97,7 @@
class IOManager # :nodoc:
DEFAULT_BUFFER = 2**20
-
+
def initialize(processor, server_transport, transport_factory, protocol_factory, num, logger)
@processor = processor
@server_transport = server_transport
@@ -142,7 +142,7 @@
end
private
-
+
def run
spin_worker_threads
diff --git a/lib/rb/lib/thrift/server/simple_server.rb b/lib/rb/lib/thrift/server/simple_server.rb
index 905fe9b..311527d 100644
--- a/lib/rb/lib/thrift/server/simple_server.rb
+++ b/lib/rb/lib/thrift/server/simple_server.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -39,7 +39,7 @@
@server_transport.close
end
end
-
+
def to_s
"simple(#{super.to_s})"
end
diff --git a/lib/rb/lib/thrift/server/thread_pool_server.rb b/lib/rb/lib/thrift/server/thread_pool_server.rb
index bb754ad..97e12e1 100644
--- a/lib/rb/lib/thrift/server/thread_pool_server.rb
+++ b/lib/rb/lib/thrift/server/thread_pool_server.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
require 'thread'
@@ -71,7 +71,7 @@
@server_transport.close
end
end
-
+
def to_s
"threadpool(#{super.to_s})"
end
diff --git a/lib/rb/lib/thrift/server/threaded_server.rb b/lib/rb/lib/thrift/server/threaded_server.rb
index 88ee183..29e3c46 100644
--- a/lib/rb/lib/thrift/server/threaded_server.rb
+++ b/lib/rb/lib/thrift/server/threaded_server.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -43,7 +43,7 @@
@server_transport.close
end
end
-
+
def to_s
"threaded(#{super.to_s})"
end
diff --git a/lib/rb/lib/thrift/struct.rb b/lib/rb/lib/thrift/struct.rb
index df9d656..e353df4 100644
--- a/lib/rb/lib/thrift/struct.rb
+++ b/lib/rb/lib/thrift/struct.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
require 'set'
@@ -24,15 +24,15 @@
def initialize(d={}, &block)
# get a copy of the default values to work on, removing defaults in favor of arguments
fields_with_defaults = fields_with_default_values.dup
-
- # check if the defaults is empty, or if there are no parameters for this
+
+ # check if the defaults is empty, or if there are no parameters for this
# instantiation, and if so, don't bother overriding defaults.
unless fields_with_defaults.empty? || d.empty?
d.each_key do |name|
fields_with_defaults.delete(name.to_s)
end
end
-
+
# assign all the user-specified arguments
unless d.empty?
d.each do |name, value|
@@ -43,14 +43,14 @@
instance_variable_set("@#{name}", value)
end
end
-
+
# assign all the default values
unless fields_with_defaults.empty?
fields_with_defaults.each do |name, default_value|
instance_variable_set("@#{name}", (default_value.dup rescue default_value))
end
end
-
+
yield self if block_given?
end
@@ -67,7 +67,7 @@
end
fields_with_default_values
end
-
+
def inspect(skip_optional_nulls = true)
fields = []
each_field do |fid, field_info|
diff --git a/lib/rb/lib/thrift/struct_union.rb b/lib/rb/lib/thrift/struct_union.rb
index e21b39e..e76ab1b 100644
--- a/lib/rb/lib/thrift/struct_union.rb
+++ b/lib/rb/lib/thrift/struct_union.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -159,7 +159,7 @@
def inspect_field(value, field_info)
if enum_class = field_info[:enum_class]
"#{enum_class.const_get(:VALUE_MAP)[value]} (#{value})"
- elsif value.is_a? Hash
+ elsif value.is_a? Hash
if field_info[:type] == Types::MAP
map_buf = []
value.each do |k, v|
@@ -180,13 +180,13 @@
value.inspect
end
end
-
+
def inspect_collection(collection, field_info)
buf = []
collection.each do |k|
buf << inspect_field(k, field_info[:element])
end
- "[" + buf.join(", ") + "]"
+ "[" + buf.join(", ") + "]"
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/rb/lib/thrift/thrift_native.rb b/lib/rb/lib/thrift/thrift_native.rb
index 4d8df61..372f3a5 100644
--- a/lib/rb/lib/thrift/thrift_native.rb
+++ b/lib/rb/lib/thrift/thrift_native.rb
@@ -21,4 +21,4 @@
require "thrift_native"
rescue LoadError
puts "Unable to load thrift_native extension. Defaulting to pure Ruby libraries."
-end
\ No newline at end of file
+end
diff --git a/lib/rb/lib/thrift/transport/base_server_transport.rb b/lib/rb/lib/thrift/transport/base_server_transport.rb
index 0105463..25cea29 100644
--- a/lib/rb/lib/thrift/transport/base_server_transport.rb
+++ b/lib/rb/lib/thrift/transport/base_server_transport.rb
@@ -1,5 +1,5 @@
# encoding: ascii-8bit
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,16 +7,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
module Thrift
class BaseServerTransport
@@ -27,7 +27,7 @@
def accept
raise NotImplementedError
end
-
+
def close; nil; end
def closed?
diff --git a/lib/rb/lib/thrift/transport/buffered_transport.rb b/lib/rb/lib/thrift/transport/buffered_transport.rb
index 4fe9c41..3405cb3 100644
--- a/lib/rb/lib/thrift/transport/buffered_transport.rb
+++ b/lib/rb/lib/thrift/transport/buffered_transport.rb
@@ -1,5 +1,5 @@
# encoding: ascii-8bit
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,9 +7,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -21,7 +21,7 @@
module Thrift
class BufferedTransport < BaseTransport
DEFAULT_BUFFER = 4096
-
+
def initialize(transport)
@transport = transport
@wbuf = Bytes.empty_byte_buffer
@@ -101,7 +101,7 @@
@transport.write(@wbuf)
@wbuf = Bytes.empty_byte_buffer
end
-
+
@transport.flush
end
@@ -114,7 +114,7 @@
def get_transport(transport)
return BufferedTransport.new(transport)
end
-
+
def to_s
"buffered"
end
diff --git a/lib/rb/lib/thrift/transport/framed_transport.rb b/lib/rb/lib/thrift/transport/framed_transport.rb
index 9531778..74b664d 100644
--- a/lib/rb/lib/thrift/transport/framed_transport.rb
+++ b/lib/rb/lib/thrift/transport/framed_transport.rb
@@ -1,5 +1,5 @@
# encoding: ascii-8bit
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,9 +7,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -117,7 +117,7 @@
def get_transport(transport)
return FramedTransport.new(transport)
end
-
+
def to_s
"framed"
end
diff --git a/lib/rb/lib/thrift/transport/http_client_transport.rb b/lib/rb/lib/thrift/transport/http_client_transport.rb
index c84304d..7559dc6 100644
--- a/lib/rb/lib/thrift/transport/http_client_transport.rb
+++ b/lib/rb/lib/thrift/transport/http_client_transport.rb
@@ -55,7 +55,7 @@
ensure
@outbuf = Bytes.empty_byte_buffer
end
-
+
def to_s
"@{self.url}"
end
diff --git a/lib/rb/lib/thrift/transport/io_stream_transport.rb b/lib/rb/lib/thrift/transport/io_stream_transport.rb
index ccec68f..3b9b6b7 100644
--- a/lib/rb/lib/thrift/transport/io_stream_transport.rb
+++ b/lib/rb/lib/thrift/transport/io_stream_transport.rb
@@ -1,5 +1,5 @@
# encoding: ascii-8bit
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,9 +7,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
diff --git a/lib/rb/lib/thrift/transport/memory_buffer_transport.rb b/lib/rb/lib/thrift/transport/memory_buffer_transport.rb
index 469ea73..f2806c2 100644
--- a/lib/rb/lib/thrift/transport/memory_buffer_transport.rb
+++ b/lib/rb/lib/thrift/transport/memory_buffer_transport.rb
@@ -1,5 +1,5 @@
# encoding: ascii-8bit
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,9 +7,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -112,16 +112,16 @@
# if idx != 0
# out << " "
# end
-
+
if idx == @index
out << ">"
end
-
+
out << @buf[idx].ord.to_s(16)
end
out.join(" ")
end
-
+
def to_s
"memory"
end
diff --git a/lib/rb/lib/thrift/transport/server_socket.rb b/lib/rb/lib/thrift/transport/server_socket.rb
index b21c65f..9ce675a 100644
--- a/lib/rb/lib/thrift/transport/server_socket.rb
+++ b/lib/rb/lib/thrift/transport/server_socket.rb
@@ -1,5 +1,5 @@
# encoding: ascii-8bit
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,16 +7,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
require 'socket'
diff --git a/lib/rb/lib/thrift/transport/socket.rb b/lib/rb/lib/thrift/transport/socket.rb
index 0f58ded..05fc4c0 100644
--- a/lib/rb/lib/thrift/transport/socket.rb
+++ b/lib/rb/lib/thrift/transport/socket.rb
@@ -1,5 +1,5 @@
# encoding: ascii-8bit
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,16 +7,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
require 'socket'
diff --git a/lib/rb/lib/thrift/transport/ssl_server_socket.rb b/lib/rb/lib/thrift/transport/ssl_server_socket.rb
index 3abd5ec..8ca072a 100644
--- a/lib/rb/lib/thrift/transport/ssl_server_socket.rb
+++ b/lib/rb/lib/thrift/transport/ssl_server_socket.rb
@@ -33,7 +33,7 @@
socket = TCPServer.new(@host, @port)
@handle = OpenSSL::SSL::SSLServer.new(socket, @ssl_context)
end
-
+
def to_s
"ssl(#{super.to_s})"
end
diff --git a/lib/rb/lib/thrift/transport/ssl_socket.rb b/lib/rb/lib/thrift/transport/ssl_socket.rb
index 7ab96ab..e71f297 100644
--- a/lib/rb/lib/thrift/transport/ssl_socket.rb
+++ b/lib/rb/lib/thrift/transport/ssl_socket.rb
@@ -43,7 +43,7 @@
raise TransportException.new(TransportException::NOT_OPEN, "Could not connect to #{@desc}: #{e}")
end
end
-
+
def to_s
"ssl(#{super.to_s})"
end
diff --git a/lib/rb/lib/thrift/transport/unix_server_socket.rb b/lib/rb/lib/thrift/transport/unix_server_socket.rb
index 057d122..e1eef75 100644
--- a/lib/rb/lib/thrift/transport/unix_server_socket.rb
+++ b/lib/rb/lib/thrift/transport/unix_server_socket.rb
@@ -1,5 +1,5 @@
# encoding: ascii-8bit
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,16 +7,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
require 'socket'
diff --git a/lib/rb/lib/thrift/transport/unix_socket.rb b/lib/rb/lib/thrift/transport/unix_socket.rb
index 5dffd59..76a7bad 100644
--- a/lib/rb/lib/thrift/transport/unix_socket.rb
+++ b/lib/rb/lib/thrift/transport/unix_socket.rb
@@ -1,5 +1,5 @@
# encoding: ascii-8bit
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,16 +7,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
require 'socket'
@@ -36,7 +36,7 @@
raise TransportException.new(TransportException::NOT_OPEN, "Could not open UNIX socket at #{@path}")
end
end
-
+
def to_s
"domain(#{@path})"
end
diff --git a/lib/rb/lib/thrift/types.rb b/lib/rb/lib/thrift/types.rb
index 0f6ab42..4cec159 100644
--- a/lib/rb/lib/thrift/types.rb
+++ b/lib/rb/lib/thrift/types.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
require 'set'
diff --git a/lib/rb/lib/thrift/union.rb b/lib/rb/lib/thrift/union.rb
index 822ab2f..82af636 100644
--- a/lib/rb/lib/thrift/union.rb
+++ b/lib/rb/lib/thrift/union.rb
@@ -1,4 +1,4 @@
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -6,16 +6,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
module Thrift
class Union
@@ -105,7 +105,7 @@
klass.send :define_method, field_info[:name] do
if field_info[:name].to_sym == @setfield
@value
- else
+ else
raise RuntimeError, "#{field_info[:name]} is not union's set field."
end
end
@@ -130,7 +130,7 @@
end
end
- # get the symbol that indicates what the currently set field type is.
+ # get the symbol that indicates what the currently set field type is.
def get_set_field
@setfield
end
diff --git a/lib/rb/script/proto_benchmark.rb b/lib/rb/script/proto_benchmark.rb
index bb49e2e..f1c90d2 100644
--- a/lib/rb/script/proto_benchmark.rb
+++ b/lib/rb/script/proto_benchmark.rb
@@ -42,13 +42,13 @@
binser.serialize(obj)
end
end
-
+
reporter.report("accelerated binary protocol, write") do
HOW_MANY.times do
accel_bin_ser.serialize(obj)
end
end
-
+
reporter.report("compact protocol, write") do
# RubyProf.start
HOW_MANY.times do
@@ -60,26 +60,25 @@
# printer.print(file, 0)
# file.close
end
-
+
reporter.report("binary protocol, read") do
HOW_MANY.times do
bindeser.deserialize(obj, bin_data)
end
end
-
+
reporter.report("accelerated binary protocol, read") do
HOW_MANY.times do
accel_bin_deser.deserialize(obj, bin_data)
end
end
-
+
reporter.report("compact protocol, read") do
HOW_MANY.times do
compact_deser.deserialize(obj, compact_data)
end
end
-
# f = File.new("/tmp/testfile", "w")
# proto = Thrift::BinaryProtocolAccelerated.new(Thrift::IOStreamTransport.new(Thrift::MemoryBufferTransport.new, f))
# reporter.report("accelerated binary protocol, write (to disk)") do
@@ -89,7 +88,7 @@
# f.flush
# end
# f.close
- #
+ #
# f = File.new("/tmp/testfile", "r")
# proto = Thrift::BinaryProtocolAccelerated.new(Thrift::IOStreamTransport.new(f, Thrift::MemoryBufferTransport.new))
# reporter.report("accelerated binary protocol, read (from disk)") do
@@ -98,7 +97,7 @@
# end
# end
# f.close
- #
+ #
# f = File.new("/tmp/testfile", "w")
# reporter.report("compact protocol, write (to disk)") do
# proto = Thrift::CompactProtocol.new(Thrift::IOStreamTransport.new(Thrift::MemoryBufferTransport.new, f))
@@ -108,7 +107,7 @@
# f.flush
# end
# f.close
- #
+ #
# f = File.new("/tmp/testfile", "r")
# reporter.report("compact protocol, read (from disk)") do
# proto = Thrift::CompactProtocol.new(Thrift::IOStreamTransport.new(f, Thrift::MemoryBufferTransport.new))
diff --git a/lib/rb/script/read_struct.rb b/lib/rb/script/read_struct.rb
index 831fcec..e3c5efe 100644
--- a/lib/rb/script/read_struct.rb
+++ b/lib/rb/script/read_struct.rb
@@ -38,6 +38,6 @@
puts "Object verified successfully!"
else
puts "Object failed verification! Expected #{Fixtures::COMPACT_PROTOCOL_TEST_STRUCT.inspect} but got #{cpts.inspect}"
-
+
puts cpts.differences(Fixtures::COMPACT_PROTOCOL_TEST_STRUCT)
end
diff --git a/lib/rb/script/write_struct.rb b/lib/rb/script/write_struct.rb
index da14219..fa03639 100644
--- a/lib/rb/script/write_struct.rb
+++ b/lib/rb/script/write_struct.rb
@@ -27,4 +27,4 @@
File.open(path, "w") do |file|
file.write(ser.serialize(Fixtures::COMPACT_PROTOCOL_TEST_STRUCT))
-end
\ No newline at end of file
+end
diff --git a/lib/rb/spec/base_transport_spec.rb b/lib/rb/spec/base_transport_spec.rb
index d2f60aa..d09ba2b 100644
--- a/lib/rb/spec/base_transport_spec.rb
+++ b/lib/rb/spec/base_transport_spec.rb
@@ -48,7 +48,7 @@
it "should alias << to write" do
expect(Thrift::BaseTransport.instance_method(:<<)).to eq(Thrift::BaseTransport.instance_method(:write))
end
-
+
it "should provide a reasonable to_s" do
expect(Thrift::BaseTransport.new.to_s).to eq("base")
end
@@ -67,7 +67,7 @@
transport = double("Transport")
expect(Thrift::BaseTransportFactory.new.get_transport(transport)).to eql(transport)
end
-
+
it "should provide a reasonable to_s" do
expect(Thrift::BaseTransportFactory.new.to_s).to eq("base")
end
@@ -149,7 +149,7 @@
expect(Thrift::BufferedTransport).to receive(:new).with(trans).and_return(btrans)
expect(Thrift::BufferedTransportFactory.new.get_transport(trans)).to eq(btrans)
end
-
+
it "should provide a reasonable to_s" do
expect(Thrift::BufferedTransportFactory.new.to_s).to eq("buffered")
end
@@ -271,7 +271,7 @@
expect(Thrift::FramedTransport).to receive(:new).with(trans)
Thrift::FramedTransportFactory.new.get_transport(trans)
end
-
+
it "should provide a reasonable to_s" do
expect(Thrift::FramedTransportFactory.new.to_s).to eq("framed")
end
diff --git a/lib/rb/spec/binary_protocol_spec_shared.rb b/lib/rb/spec/binary_protocol_spec_shared.rb
index d8edf85..8de39ef 100644
--- a/lib/rb/spec/binary_protocol_spec_shared.rb
+++ b/lib/rb/spec/binary_protocol_spec_shared.rb
@@ -57,7 +57,6 @@
expect(@trans.read(@trans.available)).to eq("\200\001\000\001\000\000\000\vtestMessage\000\000\000\021")
end
-
# message footer is a noop
it "should write the field header" do
diff --git a/lib/rb/spec/compact_protocol_spec.rb b/lib/rb/spec/compact_protocol_spec.rb
index 7519810..e5cb111 100644
--- a/lib/rb/spec/compact_protocol_spec.rb
+++ b/lib/rb/spec/compact_protocol_spec.rb
@@ -31,14 +31,14 @@
:double => [0.0, 1.0, -1.0, 1.1, -1.1, 10000000.1, 1.0/0.0, -1.0/0.0],
:bool => [true, false]
}
-
+
it "should encode and decode naked primitives correctly" do
TESTS.each_pair do |primitive_type, test_values|
test_values.each do |value|
# puts "testing #{value}" if primitive_type == :i64
trans = Thrift::MemoryBufferTransport.new
proto = Thrift::CompactProtocol.new(trans)
-
+
proto.send(writer(primitive_type), value)
# puts "buf: #{trans.inspect_buffer}" if primitive_type == :i64
read_back = proto.send(reader(primitive_type))
@@ -46,7 +46,7 @@
end
end
end
-
+
it "should encode and decode primitives in fields correctly" do
TESTS.each_pair do |primitive_type, test_values|
final_primitive_type = primitive_type == :binary ? :string : primitive_type
@@ -104,7 +104,7 @@
struct.write(proto)
struct2 = Thrift::Test::CompactProtoTestStruct.new
- struct2.read(proto)
+ struct2.read(proto)
expect(struct2).to eq(struct)
end
@@ -123,13 +123,13 @@
processor.process(client_out_proto, client_in_proto)
expect(client.recv_Janky).to eq(2)
end
-
+
it "should deal with fields following fields that have non-delta ids" do
brcp = Thrift::Test::BreaksRubyCompactProtocol.new(
- :field1 => "blah",
+ :field1 => "blah",
:field2 => Thrift::Test::BigFieldIdStruct.new(
- :field1 => "string1",
- :field2 => "string2"),
+ :field1 => "string1",
+ :field2 => "string2"),
:field3 => 3)
ser = Thrift::Serializer.new(Thrift::CompactProtocolFactory.new)
bytes = ser.serialize(brcp)
@@ -139,7 +139,7 @@
deser.deserialize(brcp2, bytes)
expect(brcp2).to eq(brcp)
end
-
+
it "should deserialize an empty map to an empty hash" do
struct = Thrift::Test::SingleMapTestStruct.new(:i32_map => {})
ser = Thrift::Serializer.new(Thrift::CompactProtocolFactory.new)
@@ -150,22 +150,22 @@
deser.deserialize(struct2, bytes)
expect(struct).to eq(struct2)
end
-
+
it "should provide a reasonable to_s" do
trans = Thrift::MemoryBufferTransport.new
expect(Thrift::CompactProtocol.new(trans).to_s).to eq("compact(memory)")
end
-
+
class JankyHandler
def Janky(i32arg)
i32arg * 2
end
end
-
+
def writer(sym)
"write_#{sym.to_s}"
end
-
+
def reader(sym)
"read_#{sym.to_s}"
end
diff --git a/lib/rb/spec/http_client_spec.rb b/lib/rb/spec/http_client_spec.rb
index bc7e128..3c02319 100644
--- a/lib/rb/spec/http_client_spec.rb
+++ b/lib/rb/spec/http_client_spec.rb
@@ -25,7 +25,7 @@
before(:each) do
@client = Thrift::HTTPClientTransport.new("http://my.domain.com/path/to/service?param=value")
end
-
+
it "should provide a reasonable to_s" do
@client.to_s == "http://my.domain.com/path/to/service?param=value"
end
diff --git a/lib/rb/spec/server_spec.rb b/lib/rb/spec/server_spec.rb
index 57f5237..47204aa 100644
--- a/lib/rb/spec/server_spec.rb
+++ b/lib/rb/spec/server_spec.rb
@@ -38,7 +38,7 @@
it "should not serve" do
expect { @server.serve()}.to raise_error(NotImplementedError)
end
-
+
it "should provide a reasonable to_s" do
expect(@serverTrans).to receive(:to_s).once.and_return("serverTrans")
expect(@trans).to receive(:to_s).once.and_return("trans")
@@ -56,14 +56,14 @@
@client = double("Client")
@server = described_class.new(@processor, @serverTrans, @trans, @prot)
end
-
+
it "should provide a reasonable to_s" do
expect(@serverTrans).to receive(:to_s).once.and_return("serverTrans")
expect(@trans).to receive(:to_s).once.and_return("trans")
expect(@prot).to receive(:to_s).once.and_return("prot")
expect(@server.to_s).to eq("simple(server(prot(trans(serverTrans))))")
end
-
+
it "should serve in the main thread" do
expect(@serverTrans).to receive(:listen).ordered
expect(@serverTrans).to receive(:accept).exactly(3).times.and_return(@client)
@@ -99,7 +99,7 @@
expect(@prot).to receive(:to_s).once.and_return("prot")
expect(@server.to_s).to eq("threaded(server(prot(trans(serverTrans))))")
end
-
+
it "should serve using threads" do
expect(@serverTrans).to receive(:listen).ordered
expect(@serverTrans).to receive(:accept).exactly(3).times.and_return(@client)
@@ -137,10 +137,10 @@
expect(@prot).to receive(:to_s).once.and_return("prot")
expect(@server.to_s).to eq("threadpool(server(prot(trans(server_trans))))")
end
-
+
it "should serve inside a thread" do
exception_q = @server.instance_variable_get(:@exception_q)
- expect_any_instance_of(described_class).to receive(:serve) do
+ expect_any_instance_of(described_class).to receive(:serve) do
exception_q.push(StandardError.new('ERROR'))
end
expect { @server.rescuable_serve }.to(raise_error('ERROR'))
@@ -149,7 +149,7 @@
it "should avoid running the server twice when retrying rescuable_serve" do
exception_q = @server.instance_variable_get(:@exception_q)
- expect_any_instance_of(described_class).to receive(:serve) do
+ expect_any_instance_of(described_class).to receive(:serve) do
exception_q.push(StandardError.new('ERROR1'))
exception_q.push(StandardError.new('ERROR2'))
end
diff --git a/lib/rb/spec/unix_socket_spec.rb b/lib/rb/spec/unix_socket_spec.rb
index 8623e95..7f878a1 100644
--- a/lib/rb/spec/unix_socket_spec.rb
+++ b/lib/rb/spec/unix_socket_spec.rb
@@ -42,7 +42,7 @@
allow(::UNIXSocket).to receive(:new)
expect(Thrift::UNIXSocket.new(@path, 5).timeout).to eq(5)
end
-
+
it "should provide a reasonable to_s" do
allow(::UNIXSocket).to receive(:new)
expect(Thrift::UNIXSocket.new(@path).to_s).to eq("domain(#{@path})")