Module: JMongo

Defined in:
lib/jmongo/mongo/jmongo.rb

Constant Summary collapse

SECS_TO_MILLI_FUNC =
lambda { |v| v.to_f * 1_000 }
DO_NOTHING_FUNC =
lambda { |v| v }
RUBY_JAVA_OPTIONS_KEYS =
{
  :pool_size => [:connections_per_host, DO_NOTHING_FUNC],
  :pool_timeout => [:max_wait_time, SECS_TO_MILLI_FUNC],
  :timeout => [:max_wait_time, SECS_TO_MILLI_FUNC],
  :op_timeout => [:socket_timeout, SECS_TO_MILLI_FUNC],
  :connect_timeout => [:connect_timeout, SECS_TO_MILLI_FUNC]
}

Class Method Summary collapse

Class Method Details

.options_ruby2java_lu(key) ⇒ Object



32
33
34
# File 'lib/jmongo/mongo/jmongo.rb', line 32

def self.options_ruby2java_lu(key)
  RUBY_JAVA_OPTIONS_KEYS[key].first || key
end

.options_ruby2java_xf(key, val) ⇒ Object



36
37
38
# File 'lib/jmongo/mongo/jmongo.rb', line 36

def self.options_ruby2java_xf(key,val)
  RUBY_JAVA_OPTIONS_KEYS[key].last[val] || val
end