app/models/switchman/shard.rb
# it's tedious to hold onto this same
# kind of sign state and transform the
# result in multiple places, so
# here we can operate on the absolute value
# in a provided block and trust the sign will
# stay as provided.  This assumes no consumer
# will return a nil value from the block.
it's tedious to hold onto this same
kind of sign state and transform the
result in multiple places, so
here we can operate on the absolute value
in a provided block and trust the sign will
stay as provided.  This assumes no consumer
will return a nil value from the block.
it ' s tedious to hold onto this same kind of sign state and transform the result in multiple places so here we can operate on the absolute value in a provided block and trust the sign will stay as provided . This assumes no consumer will return a nil value from the block .
def signed_id_operation(input_id)
        sign = input_id < 0 ? -1 : 1
        output = yield input_id.abs
        output * sign
      end
def signed_id_operation ( input_id ) sign = input_id < 0 ? - 1 : 1 output = yield input_id . abs output * sign end
it's tedious to hold onto this same
kind of sign state and transform the
result in multiple places, so
here we can operate on the absolute value
in a provided block and trust the sign will
stay as provided.
it ' s tedious to hold onto this same kind of sign state and transform the result in multiple places so here we can operate on the absolute value in a provided block and trust the sign will stay as provided .
input_id
<not_specific>