repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
capistrano/rvm | https://github.com/capistrano/rvm/blob/9cfef39cf0022839dca6b5b330dfefeb5fc363e7/lib/capistrano-rvm.rb | lib/capistrano-rvm.rb | ruby | MIT | 9cfef39cf0022839dca6b5b330dfefeb5fc363e7 | 2026-01-04T17:42:46.581795Z | false | |
capistrano/rvm | https://github.com/capistrano/rvm/blob/9cfef39cf0022839dca6b5b330dfefeb5fc363e7/lib/capistrano/rvm.rb | lib/capistrano/rvm.rb | load File.expand_path("../tasks/rvm.rake", __FILE__)
| ruby | MIT | 9cfef39cf0022839dca6b5b330dfefeb5fc363e7 | 2026-01-04T17:42:46.581795Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/spec/helper.rb | spec/helper.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/spec/api-ai-ruby/user_entities_request_spec.rb | spec/api-ai-ruby/user_entities_request_spec.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/spec/api-ai-ruby/context_request_spec.rb | spec/api-ai-ruby/context_request_spec.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/spec/api-ai-ruby/api_spec.rb | spec/api-ai-ruby/api_spec.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/spec/api-ai-ruby/client_spec.rb | spec/api-ai-ruby/client_spec.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/spec/api-ai-ruby/voice_request_spec.rb | spec/api-ai-ruby/voice_request_spec.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/spec/api-ai-ruby/text_request_spec.rb | spec/api-ai-ruby/text_request_spec.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/spec/api-ai-ruby/error_spec.rb | spec/api-ai-ruby/error_spec.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby.rb | lib/api-ai-ruby.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/request_error.rb | lib/api-ai-ruby/request_error.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/constants.rb | lib/api-ai-ruby/constants.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/client.rb | lib/api-ai-ruby/client.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/client_error.rb | lib/api-ai-ruby/client_error.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/models/entry.rb | lib/api-ai-ruby/models/entry.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/models/entity.rb | lib/api-ai-ruby/models/entity.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/models/context.rb | lib/api-ai-ruby/models/context.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/request/voice_request.rb | lib/api-ai-ruby/request/voice_request.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/request/request_query.rb | lib/api-ai-ruby/request/request_query.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/request/text_request.rb | lib/api-ai-ruby/request/text_request.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/request/event_request.rb | lib/api-ai-ruby/request/event_request.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/crud/user_entity_request.rb | lib/api-ai-ruby/crud/user_entity_request.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
dialogflow/dialogflow-ruby-client | https://github.com/dialogflow/dialogflow-ruby-client/blob/33abeb53d9761d3764c692cf02fa4e15a41667da/lib/api-ai-ruby/crud/contexts_request.rb | lib/api-ai-ruby/crud/contexts_request.rb | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed 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 a... | ruby | Apache-2.0 | 33abeb53d9761d3764c692cf02fa4e15a41667da | 2026-01-04T17:42:49.856203Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/benchmark/profile_large_list.rb | benchmark/profile_large_list.rb | # frozen_string_literal: true
require_relative "setup"
require "stackprof"
driver = ENV.fetch("DRIVER", "ruby").to_sym
redis_client = RedisClient.new(host: "localhost", port: Servers::REDIS.real_port, driver: driver)
redis_client.call("LPUSH", "list", *1000.times.to_a)
StackProf.run(out: "tmp/stackprof-large-list.du... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/benchmark/setup.rb | benchmark/setup.rb | # frozen_string_literal: true
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
$LOAD_PATH.unshift(File.expand_path("../hiredis-client/lib", __dir__))
$LOAD_PATH.unshift(File.expand_path("../test/support", __dir__))
require "redis"
require "redis-client"
require "hiredis-client"
require "servers"
require "bench... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/benchmark/pipelined.rb | benchmark/pipelined.rb | # frozen_string_literal: true
require_relative "setup"
driver = ENV.fetch("DRIVER", "ruby").to_sym
redis_client = RedisClient.new(host: "localhost", port: Servers::REDIS.real_port, driver: driver)
redis = Redis.new(host: "localhost", port: Servers::REDIS.real_port, driver: driver)
redis_client.call("SET", "key", "va... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/benchmark/single.rb | benchmark/single.rb | # frozen_string_literal: true
require_relative "setup"
driver = ENV.fetch("DRIVER", "ruby").to_sym
redis_client = RedisClient.new(host: "localhost", port: Servers::REDIS.real_port, driver: driver)
redis = Redis.new(host: "localhost", port: Servers::REDIS.real_port, driver: driver)
redis_client.call("SET", "key", "va... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/benchmark/profile_pipeline.rb | benchmark/profile_pipeline.rb | # frozen_string_literal: true
require_relative "setup"
require "stackprof"
driver = ENV.fetch("DRIVER", "ruby").to_sym
redis_client = RedisClient.new(host: "localhost", port: Servers::REDIS.real_port, driver: driver)
StackProf.run(out: "tmp/stackprof-pipeline.dump", raw: true) do
10_000.times do
redis_client.p... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/benchmark/drivers.rb | benchmark/drivers.rb | # frozen_string_literal: true
require_relative "setup"
ruby = RedisClient.new(host: "localhost", port: Servers::REDIS.real_port, driver: :ruby)
hiredis = RedisClient.new(host: "localhost", port: Servers::REDIS.real_port, driver: :hiredis)
ruby.call("SET", "key", "value")
ruby.call("SET", "large", "value" * 10_000)
r... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/benchmark/profile_large_string.rb | benchmark/profile_large_string.rb | # frozen_string_literal: true
require_relative "setup"
require "stackprof"
driver = ENV.fetch("DRIVER", "ruby").to_sym
redis_client = RedisClient.new(host: "localhost", port: Servers::REDIS.real_port, driver: driver)
redis_client.call("SET", "large", "value" * 10_000)
StackProf.run(out: "tmp/stackprof-large-string.d... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/test_config.rb | test/test_config.rb | # frozen_string_literal: true
Megatest.config do |c|
c.global_setup do
ServerManager.kill_all
$stderr.puts "Running test suite with driver: #{RedisClient.default_driver}"
end
c.job_setup do |_, index|
Servers::TESTS.shutdown
Servers::SENTINEL_TESTS.shutdown
ServerManager.worker_index = inde... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/env.rb | test/env.rb | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
$LOAD_PATH.unshift File.expand_path("../hiredis-client/lib", __dir__)
require "redis-client"
require "redis_client/decorator"
require "toxiproxy"
require "stringio"
Dir[File.join(__dir__, "support/**/*.rb")].sort.each { |f| require... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
require_relative "env"
Servers.build_redis
Servers::SENTINEL_TESTS.shutdown
Servers.all = Servers::TESTS
class RedisClientTestCase < Megatest::Test
end
| ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client_test.rb | test/redis_client_test.rb | # frozen_string_literal: true
require "test_helper"
class RedisClientTest < RedisClientTestCase
include ClientTestHelper
include RedisClientTests
def test_preselect_database
client = new_client(db: 5)
assert_includes client.call("CLIENT", "INFO"), " db=5 "
client.call("SELECT", 6)
assert_includ... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/support/raise_warnings.rb | test/support/raise_warnings.rb | # frozen_string_literal: true
$VERBOSE = true
module RaiseWarnings
def warn(message, *)
return if message.match?(/Ractor.*is experimental/)
super
raise message
end
ruby2_keywords :warn if respond_to?(:ruby2_keywords, true)
end
Warning.singleton_class.prepend(RaiseWarnings)
| ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/support/servers.rb | test/support/servers.rb | # frozen_string_literal: true
require_relative "redis_builder"
require_relative "server_manager"
module Servers
ROOT = Pathname.new(File.expand_path("../../", __dir__))
platform = `echo $(uname -m)-$(uname -s | tr '[:upper:]' '[:lower:]')`.strip
CACHE_DIR = ROOT.join("tmp/cache", platform)
HOST = "127.0.0.1"... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/support/driver.rb | test/support/driver.rb | # frozen_string_literal: true
| ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/support/server_manager.rb | test/support/server_manager.rb | # frozen_string_literal: true
require "pathname"
class ServerManager
ROOT = Pathname.new(File.expand_path("../../", __dir__))
class << self
def kill_all
Dir[ROOT.join("tmp/**/*.pid").to_s].each do |pid_file|
pid = begin
Integer(File.read(pid_file))
rescue ArgumentError
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/support/redis_builder.rb | test/support/redis_builder.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'digest/sha1'
require 'English'
require 'fileutils'
require 'net/http'
class RedisBuilder
TARBALL_CACHE_EXPIRATION = 60 * 10
def initialize(redis_branch, tmp_dir)
@redis_branch = redis_branch
@tmp_dir = tmp_dir
@build_dir = Servers::CACHE_DIR.... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/support/client_test_helper.rb | test/support/client_test_helper.rb | # frozen_string_literal: true
module ClientTestHelper
module FlakyDriver
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
attr_accessor :failures
end
def write(command)
if self.class.failures.first == command.first
self.class.failures.shift
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/sentinel/test_helper.rb | test/sentinel/test_helper.rb | # frozen_string_literal: true
require_relative "../env"
require_relative "../test_helper"
Servers.build_redis
Servers::SENTINEL_TESTS.prepare
Servers.all = Servers::SENTINEL_TESTS
| ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/sentinel/sentinel_test.rb | test/sentinel/sentinel_test.rb | # frozen_string_literal: true
require "test_helper"
class RedisClient
class SentinelTest < RedisClientTestCase
include ClientTestHelper
def setup
@config = new_config
super
@config = new_config
end
def check_server
retried = false
begin
@redis = @config.new_cl... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client/resp3_test.rb | test/redis_client/resp3_test.rb | # frozen_string_literal: true
require "test_helper"
require "redis_client/ruby_connection/buffered_io"
require "redis_client/ruby_connection/resp3"
class RedisClient
class RESP3Test < RedisClientTestCase
class StringIO < ::StringIO
def skip(offset)
seek(offset, IO::SEEK_CUR)
nil
end... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client/circuit_breaker_test.rb | test/redis_client/circuit_breaker_test.rb | # frozen_string_literal: true
require "test_helper"
class RedisClient
class CircuitBreakerTest < RedisClientTestCase
include ClientTestHelper
def setup
super
@circuit_breaker = CircuitBreaker.new(
error_threshold: 3,
error_threshold_timeout: 2,
success_threshold: 2,
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client/subscriptions_test.rb | test/redis_client/subscriptions_test.rb | # frozen_string_literal: true
require "test_helper"
class RedisClient
class SubscriptionsTest < RedisClientTestCase
include ClientTestHelper
def setup
super
@subscription = @redis.pubsub
end
def test_subscribe
assert_nil @subscription.call("SUBSCRIBE", "mychannel")
@redis.... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client/command_builder_test.rb | test/redis_client/command_builder_test.rb | # frozen_string_literal: true
require "test_helper"
class RedisClient
class CommandBuilderTest < RedisClientTestCase
def test_positional
assert_equal ["a", "b", "c"], call("a", "b", "c")
end
def test_array
assert_equal ["a", "b", "c"], call("a", ["b", "c"])
end
def test_hash
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client/connection_test.rb | test/redis_client/connection_test.rb | # frozen_string_literal: true
require "benchmark"
require "test_helper"
class RedisClient
module ConnectionTests
def test_connection_working
assert_equal "PONG", @redis.call("PING")
end
def test_connected?
client = new_client
refute_predicate client, :connected?
client.call("PI... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client/config_test.rb | test/redis_client/config_test.rb | # frozen_string_literal: true
require "test_helper"
class RedisClient
class ConfigTest < RedisClientTestCase
def test_simple_uri
config = Config.new(url: "redis://example.com")
assert_equal "example.com", config.host
assert_equal 6379, config.port
assert_equal "default", config.username
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client/decorator_test.rb | test/redis_client/decorator_test.rb | # frozen_string_literal: true
require "test_helper"
class RedisClient
module DecoratorTests
include ClientTestHelper
include RedisClientTests
module Commands
def exists?(key)
call("EXISTS", key) { |c| c > 0 }
end
end
MyDecorator = Decorator.create(Commands)
class MyDeco... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client/pooled_test.rb | test/redis_client/pooled_test.rb | # frozen_string_literal: true
require "test_helper"
class RedisPooledClientTest < RedisClientTestCase
include ClientTestHelper
include RedisClientTests
def test_checkout_timeout
pool = RedisClient.config(**tcp_config).new_pool(size: 1, timeout: 0.01)
Thread.new { pool.instance_variable_get(:@pool).chec... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client/middlewares_test.rb | test/redis_client/middlewares_test.rb | # frozen_string_literal: true
require "test_helper"
class RedisClient
class MiddlewaresTest < RedisClientTestCase
include ClientTestHelper
def setup
@original_module = RedisClient::Middlewares
new_module = @original_module.dup
RedisClient.send(:remove_const, :Middlewares)
RedisClien... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/redis_client/ractor_test.rb | test/redis_client/ractor_test.rb | # frozen_string_literal: true
require "test_helper"
class RactorTest < RedisClientTestCase
tag isolated: true
def setup
skip("Ractors are not supported on this Ruby version") unless defined?(::Ractor)
skip("Hiredis is not Ractor safe") if RedisClient.default_driver.name == "RedisClient::HiredisConnection... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/shared/redis_client_tests.rb | test/shared/redis_client_tests.rb | # frozen_string_literal: true
module RedisClientTests
def test_has_version
assert_instance_of String, RedisClient::VERSION
end
def test_config
assert_instance_of RedisClient::Config, @redis.config
redis_config = RedisClient.config(**tcp_config)
redis = redis_config.new_client
assert_equal "... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/test/hiredis/test_helper.rb | test/hiredis/test_helper.rb | # frozen_string_literal: true
require_relative "../test_helper"
# See: https://github.com/redis-rb/redis-client/issues/16
# The hiredis-rb gems expose all hiredis symbols, so we must be careful
# about how we link against it.
unless RUBY_PLATFORM == "java"
require "redis"
require "hiredis"
begin
Redis.new(... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client.rb | lib/redis_client.rb | # frozen_string_literal: true
require "redis_client/version"
require "redis_client/command_builder"
require "redis_client/url_config"
require "redis_client/config"
require "redis_client/pid_cache"
require "redis_client/sentinel_config"
require "redis_client/middlewares"
class RedisClient
@driver_definitions = {}
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis-client.rb | lib/redis-client.rb | # frozen_string_literal: true
require "redis_client"
| ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/circuit_breaker.rb | lib/redis_client/circuit_breaker.rb | # frozen_string_literal: true
class RedisClient
class CircuitBreaker
module Middleware
def connect(config)
config.circuit_breaker.protect { super }
end
def call(_command, config)
config.circuit_breaker.protect { super }
end
def call_pipelined(_commands, config)
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/version.rb | lib/redis_client/version.rb | # frozen_string_literal: true
class RedisClient
VERSION = "0.26.2"
end
| ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/pooled.rb | lib/redis_client/pooled.rb | # frozen_string_literal: true
require "connection_pool"
class RedisClient
class Pooled
EMPTY_HASH = {}.freeze
include Common
def initialize(
config,
id: config.id,
connect_timeout: config.connect_timeout,
read_timeout: config.read_timeout,
write_timeout: config.write_time... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/sentinel_config.rb | lib/redis_client/sentinel_config.rb | # frozen_string_literal: true
class RedisClient
class SentinelConfig
include Config::Common
SENTINEL_DELAY = 0.25
DEFAULT_RECONNECT_ATTEMPTS = 2
attr_reader :name
def initialize(
sentinels:,
sentinel_password: nil,
sentinel_username: nil,
role: :master,
name: nil,... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/connection_mixin.rb | lib/redis_client/connection_mixin.rb | # frozen_string_literal: true
class RedisClient
module ConnectionMixin
attr_accessor :retry_attempt
attr_reader :config
def initialize(config)
@pending_reads = 0
@retry_attempt = nil
@config = config
@server_key = nil
end
def reconnect
close
connect
end
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/command_builder.rb | lib/redis_client/command_builder.rb | # frozen_string_literal: true
class RedisClient
module CommandBuilder
extend self
if Symbol.method_defined?(:name)
def generate(args, kwargs = nil)
command = args.flat_map do |element|
case element
when Hash
element.flatten
else
element
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/ruby_connection.rb | lib/redis_client/ruby_connection.rb | # frozen_string_literal: true
require "socket"
require "openssl"
require "redis_client/connection_mixin"
require "redis_client/ruby_connection/buffered_io"
require "redis_client/ruby_connection/resp3"
class RedisClient
class RubyConnection
include ConnectionMixin
class << self
def ssl_context(ssl_par... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/url_config.rb | lib/redis_client/url_config.rb | # frozen_string_literal: true
require "uri"
class RedisClient
class URLConfig
attr_reader :url, :uri
def initialize(url)
@url = url
@uri = URI(url)
@unix = false
@ssl = false
case uri.scheme
when "redis"
# expected
when "rediss"
@ssl = true
wh... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/middlewares.rb | lib/redis_client/middlewares.rb | # frozen_string_literal: true
class RedisClient
class BasicMiddleware
attr_reader :client
def initialize(client)
@client = client
end
def connect(_config)
yield
end
def call(command, _config)
yield command
end
alias_method :call_pipelined, :call
end
class Mid... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/decorator.rb | lib/redis_client/decorator.rb | # frozen_string_literal: true
class RedisClient
module Decorator
class << self
def create(commands_mixin)
client_decorator = Class.new(Client)
client_decorator.include(commands_mixin)
pipeline_decorator = Class.new(Pipeline)
pipeline_decorator.include(commands_mixin)
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/config.rb | lib/redis_client/config.rb | # frozen_string_literal: true
require "openssl"
require "uri"
class RedisClient
class Config
DEFAULT_TIMEOUT = 1.0
DEFAULT_HOST = "localhost"
DEFAULT_PORT = 6379
DEFAULT_USERNAME = "default"
DEFAULT_DB = 0
module Common
attr_reader :db, :id, :ssl, :ssl_params, :command_builder, :inher... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/pid_cache.rb | lib/redis_client/pid_cache.rb | # frozen_string_literal: true
class RedisClient
module PIDCache
if !Process.respond_to?(:fork) # JRuby or TruffleRuby
@pid = Process.pid
singleton_class.attr_reader(:pid)
elsif Process.respond_to?(:_fork) # Ruby 3.1+
class << self
attr_reader :pid
def update!
@pid... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/ruby_connection/buffered_io.rb | lib/redis_client/ruby_connection/buffered_io.rb | # frozen_string_literal: true
require "io/wait" unless IO.method_defined?(:wait_readable) && IO.method_defined?(:wait_writable)
class RedisClient
class RubyConnection
class BufferedIO
EOL = "\r\n".b.freeze
EOL_SIZE = EOL.bytesize
attr_accessor :read_timeout, :write_timeout
if String.me... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/lib/redis_client/ruby_connection/resp3.rb | lib/redis_client/ruby_connection/resp3.rb | # frozen_string_literal: true
class RedisClient
module RESP3
module_function
Error = Class.new(RedisClient::Error)
UnknownType = Class.new(Error)
SyntaxError = Class.new(Error)
EOL = "\r\n".b.freeze
EOL_SIZE = EOL.bytesize
DUMP_TYPES = {
String => :dump_string,
Symbol => :du... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/hiredis-client/ext/redis_client/hiredis/extconf.rb | hiredis-client/ext/redis_client/hiredis/extconf.rb | # frozen_string_literal: true
require "mkmf"
class HiredisConnectionExtconf
def initialize(debug)
@debug = debug
end
def configure
if RUBY_ENGINE == "ruby" && !Gem.win_platform?
configure_extension
create_makefile("redis_client/hiredis_connection")
else
File.write("Makefile", dumm... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/hiredis-client/lib/hiredis-client.rb | hiredis-client/lib/hiredis-client.rb | # frozen_string_literal: true
require "redis-client"
begin
require "redis_client/hiredis_connection"
rescue LoadError
else
RedisClient.register_driver(:hiredis) { RedisClient::HiredisConnection }
RedisClient.default_driver = :hiredis
end
| ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
redis-rb/redis-client | https://github.com/redis-rb/redis-client/blob/7e737a9239cb6697a94cbba7fada1db8cc8d0596/hiredis-client/lib/redis_client/hiredis_connection.rb | hiredis-client/lib/redis_client/hiredis_connection.rb | # frozen_string_literal: true
require "openssl"
require "redis_client/hiredis_connection.so"
require "redis_client/connection_mixin"
class RedisClient
class HiredisConnection
include ConnectionMixin
class << self
def ssl_context(ssl_params)
unless ssl_params[:ca_file] || ssl_params[:ca_path]
... | ruby | MIT | 7e737a9239cb6697a94cbba7fada1db8cc8d0596 | 2026-01-04T17:42:50.353647Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/features/support/xapit_helpers.rb | features/support/xapit_helpers.rb | module XapitHelpers
def create_records(records, perform_index = true)
XapitMember.delete_all
XapitMember.xapit do
records.first.keys.each do |attribute|
if block_given?
yield(self, attribute)
else
text attribute
field attribute
facet attribute
... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/features/support/env.rb | features/support/env.rb | require 'bundler/setup'
Bundler.require(:default)
require File.expand_path('../../../spec/support/xapit_member', __FILE__)
Before do
Xapit.reset_config
Xapit.config[:spelling] = false
end
at_exit do
$server.close if $server
end
| ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/features/step_definitions/xapit_steps.rb | features/step_definitions/xapit_steps.rb | Given /^an empty database at "([^\"]*)"$/ do |path|
path = File.expand_path("../../../#{path}", __FILE__)
template = File.expand_path("../../../spec/fixtures/blankdb", __FILE__)
FileUtils.rm_rf(path) if File.exist? path
FileUtils.cp_r(template, path)
Xapit.config[:database_path] = path
XapitMember.delete_al... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/features/step_definitions/common_steps.rb | features/step_definitions/common_steps.rb | Given /^no file exists at "([^\"]*)"$/ do |path|
FileUtils.rm_rf(File.dirname(__FILE__) + "/../../#{path}") if File.exist? path
end
Then /^I should find a directory at "([^\"]*)"$/ do |path|
File.exist?(File.dirname(__FILE__) + "/../../#{path}").should be_true
end
| ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/spec_helper.rb | spec/spec_helper.rb | require 'rubygems'
require 'bundler/setup'
Bundler.require(:default)
require "support/spec_macros"
require "support/xapit_member"
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
config.inc... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/support/spec_macros.rb | spec/support/spec_macros.rb | module SpecMacros
def load_xapit_database
Xapit.reset_config
Xapit.config[:spelling] = false
end
end
| ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/support/xapit_member.rb | spec/support/xapit_member.rb | class XapitMember
include Xapit::Client::Membership
xapit { } # loads Xapit member methods
attr_reader :id
def self.find_each(&block)
@@records.each(&block) if @@records
end
def self.delete_all
@@records = []
end
def self.find(ids)
if ids.kind_of? Array
# change the order to mimic ... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/xapit_spec.rb | spec/xapit/xapit_spec.rb | require "spec_helper"
describe Xapit do
it "has default config settings" do
Xapit.config[:enabled].should eq(true)
Xapit.config[:spelling].should eq(true)
Xapit.config[:stemming].should eq("english")
end
it "can be enabled" do
Xapit.config[:enabled] = false
Xapit.enable
Xapit.config[:ena... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/server/database_spec.rb | spec/xapit/server/database_spec.rb | require "spec_helper"
describe Xapit::Server::Database do
before(:each) do
load_xapit_database
@database = Xapit.database
end
it "has a xapian database" do
@database.xapian_database.should be_kind_of(Xapian::WritableDatabase)
end
it "adds a document to the database" do
@database.xapian_data... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/server/query_spec.rb | spec/xapit/server/query_spec.rb | require "spec_helper"
describe Xapit::Server::Query do
before(:each) do
load_xapit_database
end
it "fetches results matching a simple search term" do
Xapit.database.add_document(:attributes => {:greeting => {:value => "hello world", :text => {}}}, :id => 123, :class => "Greeting")
query = Xapit::Ser... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/server/read_only_database_spec.rb | spec/xapit/server/read_only_database_spec.rb | require "spec_helper"
describe Xapit::Server::ReadOnlyDatabase do
before(:each) do
Xapit.config[:database_path] = File.expand_path('../../../tmp/xapitdb', __FILE__)
@changes_path = Xapit.changes_path
FileUtils.rm(@changes_path) if File.exist? @changes_path
@database = Xapit::Server::ReadOnlyDatabase.... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/server/indexer_spec.rb | spec/xapit/server/indexer_spec.rb | require "spec_helper"
describe Xapit::Server::Indexer do
before(:each) do
load_xapit_database
end
it "generates a xapian document with terms and values" do
indexer = Xapit::Server::Indexer.new(:attributes => {:greeting => {:value => "hello world", :text => {}}, :name => {:value => "John", :field => {}}}... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/server/app_spec.rb | spec/xapit/server/app_spec.rb | require "spec_helper"
describe Xapit::Server::App do
before(:each) do
@app = Xapit::Server::App.new
@request = Rack::MockRequest.new(@app)
end
Xapit::Server::Database::COMMANDS.each do |command|
it "passes #{command} to database and returns response in JSON" do
Xapit.database.stub(command.to_s... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/client/remote_database_spec.rb | spec/xapit/client/remote_database_spec.rb | require "spec_helper"
describe Xapit::Client::RemoteDatabase do
before(:each) do
@database = Xapit::Client::RemoteDatabase.new("http://localhost:1234")
end
Xapit::Server::Database::COMMANDS.each do |command|
it "passes #{command} to remote server using Net::HTTP" do
Xapit.config[:access_key] = "ab... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/client/membership_spec.rb | spec/xapit/client/membership_spec.rb | require "spec_helper"
describe Xapit::Client::Membership do
before(:each) do
@member_class = XapitMember
end
it "does not define search class method when xapit isn't called" do
member_class = Class.new
member_class.send(:include, Xapit::Client::Membership)
member_class.should_not respond_to(:sea... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/client/index_builder_spec.rb | spec/xapit/client/index_builder_spec.rb | require "spec_helper"
describe Xapit::Client::IndexBuilder do
it "stores text attributes with option" do
builder = Xapit::Client::IndexBuilder.new
builder.text :foo, :weight => 3
builder.text :bar, :blah
builder.attributes[:foo].should eq(:text => {:weight => 3})
builder.attributes[:bar].should e... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/client/facet_option_spec.rb | spec/xapit/client/facet_option_spec.rb | require "spec_helper"
describe Xapit::Client::FacetOption do
it "has an identifier using attribute and value" do
option = Xapit::Client::FacetOption.new("greeting", :value => "Hello")
option.identifier.should eq(Xapit.facet_identifier("greeting", "Hello"))
end
it "has a name and count matching passed op... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/client/collection_spec.rb | spec/xapit/client/collection_spec.rb | require "spec_helper"
describe Xapit::Client::Collection do
it "builds up clauses with in_classes, search, where, order calls" do
collection1 = Xapit::Client::Collection.new([:initial])
collection2 = collection1.in_classes("String").search("hello").where(:foo => "bar").order(:bar)
collection1.clauses.sho... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/client/facet_spec.rb | spec/xapit/client/facet_spec.rb | require "spec_helper"
describe Xapit::Client::Facet do
it "sets the name to capitalized attribute" do
facet = Xapit::Client::Facet.new("building_type", [])
facet.name.should eq("Building Type")
end
it "sets the name as symbol to capitalized attribute" do
facet = Xapit::Client::Facet.new(:building_ty... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/client/model_adapters/default_model_adapter_spec.rb | spec/xapit/client/model_adapters/default_model_adapter_spec.rb | require "spec_helper"
describe Xapit::Client::DefaultModelAdapter do
it "should be default for generic classes" do
Xapit::Client::DefaultModelAdapter.adapter_class(Object).should == Xapit::Client::DefaultModelAdapter
end
end
| ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/spec/xapit/client/model_adapters/active_record_adapter_spec.rb | spec/xapit/client/model_adapters/active_record_adapter_spec.rb | if ENV["MODEL_ADAPTER"].nil? || ENV["MODEL_ADAPTER"] == "active_record"
require "spec_helper"
ActiveRecord::Base.send(:include, Xapit::Client::Membership) # normally done in Railtie
RSpec.configure do |config|
config.extend WithModel
end
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :da... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit.rb | lib/xapit.rb | require 'xapian'
require 'digest/sha1'
require 'rack'
require 'json'
require 'net/http'
require 'time'
module Xapit
# A general Xapit exception
class Error < StandardError; end
# Raised when accessing the database when Xapit is disabled
class Disabled < Error; end
class << self
attr_reader :config
... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/server/query.rb | lib/xapit/server/query.rb | module Xapit
module Server
class Query
def initialize(clauses)
@clauses = clauses
@xapian_query = nil
end
def matches
enquire = Xapian::Enquire.new(Xapit.database.xapian_database)
enquire.query = xapian_query
enquire.set_sort_by_key_then_relevance(sorter,... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/server/read_only_database.rb | lib/xapit/server/read_only_database.rb | module Xapit
module Server
class ReadOnlyDatabase < Database
def add_document(data)
save_changes("add_document", data)
end
def remove_document(data)
save_changes("remove_document", data)
end
def update_document(data)
save_changes("update_document", data)
... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/server/app.rb | lib/xapit/server/app.rb | module Xapit
module Server
class App
def call(env)
request = Rack::Request.new(env)
command = request.path[%r</xapit/(.+)>, 1]
if Database::COMMANDS.include? command
authorized_action(command, request.params)
else
render :status => 404
end
en... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
ryanb/xapit | https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/server/indexer.rb | lib/xapit/server/indexer.rb | module Xapit
module Server
class Indexer
def initialize(data)
@data = data
end
def database
Xapit.database.xapian_database
end
def document
document = Xapian::Document.new
document.data = id
terms.each { |term, weight| document.add_term(term,... | ruby | MIT | 06580dcf5338ccef6e2df10783cd6e1e98ca2d3d | 2026-01-04T17:42:57.589213Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.