source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/declarations_validator_spec.rb | Ruby | mit | 97 | main | 4,575 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::DeclarationsValidator do
let(:not_an_attribute_error) do
<<~ERROR.chomp
Invalid filter for 'not_an_attribute':
#{Filterameter::DeclarationErrors::NoSuchAttributeError.new('Activity', :not_an_attribute)}
ERROR
... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/query_builder_spec.rb | Ruby | mit | 97 | main | 7,625 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::QueryBuilder do
let(:registry) do
Filterameter::Registries::Registry.new(Activity).tap do |registry|
registry.add_filter(:name, {})
registry.add_filter(:completed, {})
registry.add_filter(:task_count, range: true... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/sort_declaration_spec.rb | Ruby | mit | 97 | main | 1,619 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::SortDeclaration do
let(:declaration) { described_class.new(:size, options) }
context 'with no options' do
let(:options) { {} }
it('#parameter_name') { expect(declaration.parameter_name).to eq 'size' }
it('#name') { exp... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/filter_declaration_spec.rb | Ruby | mit | 97 | main | 4,343 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::FilterDeclaration do
let(:declaration) { described_class.new(:size, options) }
context 'with no options' do
let(:options) { {} }
it('#parameter_name') { expect(declaration.parameter_name).to eq 'size' }
it('#name') { e... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/parameters_base_spec.rb | Ruby | mit | 97 | main | 1,242 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::ParametersBase do
let(:parameters) do
Class.new(described_class).tap do |pc|
pc.add_validation(:size, [{ inclusion: { in: %w[Small Medium Large] } }])
pc.add_validation(:percent_reduced, [{ numericality: { greater_than... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/errors_spec.rb | Ruby | mit | 97 | main | 964 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Filterameter::Errors do
context 'without a validate implementation' do
let(:filter) do
Class.new do
include Filterameter::Errors
end.new
end
it 'is valid' do
expect(filter).to be_valid
end
end
context ... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/filter_factory_spec.rb | Ruby | mit | 97 | main | 2,747 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::FilterFactory do
let(:factory) { described_class.new(Project) }
let(:filter) { factory.build(declaration) }
context 'with attribute declaration' do
let(:declaration) { Filterameter::FilterDeclaration.new(:name, {}) }
it(... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/configuration_spec.rb | Ruby | mit | 97 | main | 1,831 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Configuration do
let(:config) { described_class.new }
describe 'getters and setters' do
%w[action_on_undeclared_parameters action_on_validation_failure].each do |attribute|
it("##{attribute}=") { expect(config).to respond... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/options/partial_options_spec.rb | Ruby | mit | 97 | main | 2,910 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Options::PartialOptions do
shared_examples 'matches anywhere' do
it { expect(options).to be_match_anywhere }
it { expect(options).not_to be_match_from_start }
it { expect(options).not_to be_match_dynamically }
end
sha... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/exceptions/cannot_determine_model_error_spec.rb | Ruby | mit | 97 | main | 399 | # frozen_string_literal: true
RSpec.describe Filterameter::Exceptions::CannotDetermineModelError do
let(:error) { described_class.new('foo', 'foo/bar') }
it '#message' do
expect(error.message).to eq 'Cannot determine model name from controller name (foo => Foo) ' \
'or path (fo... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/exceptions/undeclared_parameter_error_spec.rb | Ruby | mit | 97 | main | 354 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Exceptions::UndeclaredParameterError do
let(:instance) { described_class.new(:foo) }
it '#message' do
expect(instance.message).to eq 'The following filter parameter has not been declared: foo'
end
it '#key' do
expect(i... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/registries/sort_registry_spec.rb | Ruby | mit | 97 | main | 502 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Registries::SortRegistry do
let(:echo_factory) do
Class.new do
def build(name)
name
end
end.new
end
let(:declaration) do
registry = described_class.new(echo_factory)
registry.add(:foo, {})
... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/registries/registry_spec.rb | Ruby | mit | 97 | main | 605 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Registries::Registry do
let(:registry) { described_class.new(nil) }
context 'when filter is sortable (default)' do
before { registry.add_filter(:size, {}) }
it('adds sort') { expect { registry.fetch_sort(:size) }.not_to ra... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/registries/filter_registry_spec.rb | Ruby | mit | 97 | main | 2,966 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Registries::FilterRegistry do
describe '#add' do
let(:registry) { described_class.new(Filterameter::FilterFactory.new(Project)) }
let(:filter_names) { registry.filter_declarations.map(&:parameter_name) }
it 'stores two de... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/filters/nested_collection_filter_spec.rb | Ruby | mit | 97 | main | 738 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Filters::NestedCollectionFilter do
describe 'collection associations' do
let(:filter) { described_class.new([:activities], Activity, Filterameter::Filters::AttributeFilter.new(:name)) }
let(:result) { filter.apply(Project.all,... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/filters/minimum_filter_spec.rb | Ruby | mit | 97 | main | 674 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Filters::MinimumFilter do
let(:filter) { described_class.new(Activity, :task_count) }
let(:query) { filter.apply(Activity.all, 42) }
it 'valid sql' do
expect { query.explain }.not_to raise_exception
end
it 'applies crite... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/filters/conditional_scope_filter_spec.rb | Ruby | mit | 97 | main | 1,527 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Filters::ConditionalScopeFilter do
let(:filter) { described_class.new(:incomplete) }
let(:query) { class_spy(Activity) }
it 'applies filter to query when true' do
filter.apply(query, true)
expect(query).to have_received(:... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/filters/attribute_filter_spec.rb | Ruby | mit | 97 | main | 859 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Filters::AttributeFilter do
it 'applies filter to query' do
filter = described_class.new(:color)
query = class_spy(ActiveRecord::Base)
filter.apply(query, 'blue')
expect(query).to have_received(:where).with(color: 'bl... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/filters/matches_filter_spec.rb | Ruby | mit | 97 | main | 1,738 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Filters::MatchesFilter do
let(:filter) { described_class.new(:name, options) }
let(:query) { filter.apply(Activity.all, 'prepare') }
let(:options) { Filterameter::Options::PartialOptions.new(true) }
context 'with partial: true'... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/filters/nested_filter_spec.rb | Ruby | mit | 97 | main | 2,317 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Filters::NestedFilter do
let(:filter) { described_class.new([:activity], Activity, Filterameter::Filters::AttributeFilter.new(:name)) }
let(:query) { filter.apply(Task.all, 'The Activity Name') }
it 'includes joins' do
expect... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/filters/maximum_filter_spec.rb | Ruby | mit | 97 | main | 674 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Filters::MaximumFilter do
let(:filter) { described_class.new(Activity, :task_count) }
let(:query) { filter.apply(Activity.all, 42) }
it 'valid sql' do
expect { query.explain }.not_to raise_exception
end
it 'applies crite... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/filters/scope_filter_spec.rb | Ruby | mit | 97 | main | 913 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Filters::ScopeFilter do
let(:filter) { described_class.new(:in_progress) }
let(:query) { class_spy(Project) }
it 'applies filter to query' do
filter.apply(query, true)
expect(query).to have_received(:in_progress).with(tru... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/helpers/joins_values_builder_spec.rb | Ruby | mit | 97 | main | 363 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Helpers::JoinsValuesBuilder do
it 'returns association name with single entry' do
expect(described_class.build(%i[the_name])).to eq :the_name
end
it 'returns nested hash with two entries' do
expect(described_class.build(%... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/helpers/declaration_with_model_spec.rb | Ruby | mit | 97 | main | 2,969 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Helpers::DeclarationWithModel do
describe '#scope?' do
let(:inspector) { described_class.new(Task, declaration) }
context 'with scope declaration' do
let(:declaration) { Filterameter::FilterDeclaration.new(:incomplete, ... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/helpers/requested_sort_spec.rb | Ruby | mit | 97 | main | 760 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Helpers::RequestedSort do
context 'with no sign' do
let(:result) { described_class.parse('created_at') }
it('#name') { expect(result.name).to eq 'created_at' }
it('#direction') { expect(result.direction).to eq :asc }
en... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/validators/inclusion_validator_spec.rb | Ruby | mit | 97 | main | 2,030 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Validators::InclusionValidator do
let(:record) do
Class.new do
include ActiveModel::Model
attr_accessor :size
def self.name
'InclusionValidatorTestModel'
end
end.new
end
shared_examples '... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/sorts/scope_sort_spec.rb | Ruby | mit | 97 | main | 2,263 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Sorts::ScopeSort do
let(:sort) { described_class.new(:by_task_count) }
let(:query) { class_spy(Activity) }
it 'applies sort to query' do
sort.apply(query, :asc)
expect(query).to have_received(:by_task_count).with(:asc)
... |
github | RockSolt/filterameter | https://github.com/RockSolt/filterameter | spec/filterameter/sorts/attribute_sort_spec.rb | Ruby | mit | 97 | main | 843 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Filterameter::Sorts::AttributeSort do
let(:sort) { described_class.new(:color) }
let(:query) { class_spy(ActiveRecord::Base) }
it 'applies sort to query' do
sort.apply(query, :asc)
expect(query).to have_received(:order).with(color: :as... |
github | socketry/async-redis | https://github.com/socketry/async-redis | bake.rb | Ruby | mit | 97 | main | 543 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
def client
require "irb"
require "async/redis/client"
endpoint = Async::Redis.local_endpoint
client = Async::Redis::Client.new(endpoint)
Async do
binding.irb
end
end
# Update the project documentat... |
github | socketry/async-redis | https://github.com/socketry/async-redis | async-redis.gemspec | Ruby | mit | 97 | main | 1,173 | # frozen_string_literal: true
require_relative "lib/async/redis/version"
Gem::Specification.new do |spec|
spec.name = "async-redis"
spec.version = Async::Redis::VERSION
spec.summary = "A Redis client library."
spec.authors = ["Samuel Williams", "Huba Nagy", "David Ortiz", "Joan Lledó", "Gleb Sinyavskiy", "Mikae... |
github | socketry/async-redis | https://github.com/socketry/async-redis | gems.rb | Ruby | mit | 97 | main | 571 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
source "https://rubygems.org"
gemspec
# gem "protocol-redis", path: "../protocol-redis"
group :maintenance, optional: true do
gem "bake-modernize"
gem "bake-gem"
gem "bake-releases"
gem "agent-context"... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/sentinel_client.rb | Ruby | mit | 97 | main | 3,090 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "async/redis/sentinel_client"
require "sus/fixtures/async"
require "openssl"
describe Async::Redis::SentinelClient do
include Sus::Fixtures::Async::ReactorContext
let(:sentinels) {[
Async::Redis::Endp... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/disconnect.rb | Ruby | mit | 97 | main | 979 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019, by Jeremy Jung.
# Copyright, 2019, by David Ortiz.
# Copyright, 2019-2024, by Samuel Williams.
require "async/redis/client"
require "sus/fixtures/async"
describe Async::Redis::Client do
include Sus::Fixtures::Async::ReactorContext
... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/cluster_client.rb | Ruby | mit | 97 | main | 469 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
require "async/redis/cluster_client"
require "sus/fixtures/async"
require "securerandom"
describe Async::Redis::ClusterClient do
let(:client) {subject.new([])}
with "#slot_for" do
it "can compute the correct ... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/endpoint.rb | Ruby | mit | 97 | main | 7,662 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
# Copyright, 2025, by Joan Lledó.
require "async/redis/client"
require "async/redis/protocol/authenticated"
require "sus/fixtures/async"
describe Async::Redis::Endpoint do
include Sus::Fixtures::Async::Reacto... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/client.rb | Ruby | mit | 97 | main | 2,870 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
# Copyright, 2018, by Huba Nagy.
# Copyright, 2019, by David Ortiz.
require "async/clock"
require "async/redis/client"
require "sus/fixtures/async"
require "securerandom"
describe Async::Redis::Client do
incl... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/protocol/authenticated.rb | Ruby | mit | 97 | main | 1,256 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
require "async/redis/client"
require "async/redis/protocol/authenticated"
require "sus/fixtures/async"
describe Async::Redis::Protocol::Authenticated do
include Sus::Fixtures::Async::ReactorContext
let(:endpoin... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/protocol/selected.rb | Ruby | mit | 97 | main | 595 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
require "async/redis/client"
require "async/redis/protocol/selected"
require "sus/fixtures/async"
describe Async::Redis::Protocol::Selected do
include Sus::Fixtures::Async::ReactorContext
let(:endpoint) {Async:... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/methods/generic.rb | Ruby | mit | 97 | main | 1,581 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018, by Huba Nagy.
# Copyright, 2018-2025, by Samuel Williams.
require "client_context"
describe Protocol::Redis::Methods::Generic do
include_context ClientContext
let(:test_string) {"beep-boop"}
let(:string_key) {root["string_key"]}
... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/methods/strings.rb | Ruby | mit | 97 | main | 4,066 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018, by Huba Nagy.
# Copyright, 2018-2025, by Samuel Williams.
require "client_context"
describe Protocol::Redis::Methods::Strings do
include_context ClientContext
let(:string_key) {root["my_string"]}
let(:other_string_key) {root["oth... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/methods/lists.rb | Ruby | mit | 97 | main | 1,139 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018, by Huba Nagy.
# Copyright, 2018-2025, by Samuel Williams.
# Copyright, 2019, by David Ortiz.
require "client_context"
describe Protocol::Redis::Methods::Lists do
include_context ClientContext
let(:list_a) {root["list_a"]}
let(:li... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/methods/hashes.rb | Ruby | mit | 97 | main | 1,661 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019, by Mikael Henriksson.
# Copyright, 2019-2025, by Samuel Williams.
require "client_context"
describe Protocol::Redis::Methods::Hashes do
include_context ClientContext
let(:hash_field_one) {"beep-boop"}
let(:hash_field_two) {"cowbo... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/context/subscription.rb | Ruby | mit | 97 | main | 2,698 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
require "async/redis/client"
require "sus/fixtures/async"
require "securerandom"
describe Async::Redis::Context::Subscription do
include Sus::Fixtures::Async::ReactorContext
let(:endpoint) {Async::Redis.lo... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/context/transaction.rb | Ruby | mit | 97 | main | 2,098 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
require "client_context"
describe Async::Redis::Context::Transaction do
include_context ClientContext
describe "#execute" do
let(:value) {"3"}
it "can atomically execute commands" do
response = n... |
github | socketry/async-redis | https://github.com/socketry/async-redis | test/async/redis/context/pipeline.rb | Ruby | mit | 97 | main | 1,232 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019, by David Ortiz.
# Copyright, 2019-2024, by Samuel Williams.
require "async/redis/client"
require "async/redis/context/pipeline"
require "sus/fixtures/async"
describe Async::Redis::Context::Pipeline do
include Sus::Fixtures::Async::Re... |
github | socketry/async-redis | https://github.com/socketry/async-redis | cluster/test/async/redis/cluster_client.rb | Ruby | mit | 97 | main | 1,256 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
require "async/redis/cluster_client"
require "sus/fixtures/async"
require "securerandom"
describe Async::Redis::ClusterClient do
include Sus::Fixtures::Async::ReactorContext
let(:node_a) {"redis://redis-a:6379"... |
github | socketry/async-redis | https://github.com/socketry/async-redis | cluster/test/async/redis/context/subscription.rb | Ruby | mit | 97 | main | 7,869 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "async/variable"
require "async/redis/cluster_client"
require "sus/fixtures/async"
require "securerandom"
describe Async::Redis::Context::Subscription do
include Sus::Fixtures::Async::ReactorContext
wit... |
github | socketry/async-redis | https://github.com/socketry/async-redis | benchmark/performance.rb | Ruby | mit | 97 | main | 1,435 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019, by Pierre Montelle.
# Copyright, 2019-2024, by Samuel Williams.
# Copyright, 2019, by David Ortiz.
require "async/redis"
require "redis"
require "redis/connection/hiredis"
require "benchmark"
require "benchmark/ips"
keys = ["X","Y",... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis.rb | Ruby | mit | 97 | main | 390 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
# Copyright, 2020, by David Ortiz.
require_relative "redis/version"
require_relative "redis/client"
require_relative "redis/endpoint"
require_relative "redis/cluster_client"
require_relative "redis/sentinel_cl... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/endpoint.rb | Ruby | mit | 97 | main | 10,878 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
# Copyright, 2025, by Joan Lledó.
require "io/endpoint"
require "io/endpoint/host_endpoint"
require "io/endpoint/ssl_endpoint"
require "io/endpoint/unix_endpoint"
require_relative "protocol/resp2"
require_rela... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/range_map.rb | Ruby | mit | 97 | main | 1,564 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
module Async
module Redis
# A map that stores ranges and their associated values for efficient lookup.
class RangeMap
# Initialize a new RangeMap.
def initialize
@ranges = []
end
# Add a ran... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/client.rb | Ruby | mit | 97 | main | 6,434 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
# Copyright, 2018, by Huba Nagy.
# Copyright, 2019, by Mikael Henriksson.
# Copyright, 2019, by David Ortiz.
# Copyright, 2020, by Salim Semaoune.
require_relative "context/pipeline"
require_relative "context/t... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/cluster_subscription.rb | Ruby | mit | 97 | main | 3,913 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "async/limited_queue"
require "async/barrier"
module Async
module Redis
# Context for managing sharded subscriptions across multiple Redis cluster nodes.
# This class handles the complexity of subscrib... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/sentinel_client.rb | Ruby | mit | 97 | main | 5,286 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020, by David Ortiz.
# Copyright, 2023-2025, by Samuel Williams.
# Copyright, 2024, by Joan Lledó.
require_relative "client"
require "io/stream"
module Async
module Redis
# A Redis Sentinel client for high availability Redis deployments... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/key.rb | Ruby | mit | 97 | main | 1,386 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
module Async
module Redis
# Represents a Redis key with utility methods for key manipulation.
class Key
# Create a new Key instance.
# @parameter path [String] The key path.
# @returns [Key] A new... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/cluster_client.rb | Ruby | mit | 97 | main | 8,509 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
# Copyright, 2025, by Travis Bell.
require_relative "client"
require_relative "cluster_subscription"
require_relative "range_map"
require "io/stream"
require "protocol/redis/cluster/methods"
module Async
mod... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/context/generic.rb | Ruby | mit | 97 | main | 1,703 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019, by Mikael Henriksson.
# Copyright, 2019-2025, by Samuel Williams.
require "protocol/redis/methods"
module Async
module Redis
# @namespace
module Context
# Base class for Redis command execution contexts.
class Generic
#... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/context/transaction.rb | Ruby | mit | 97 | main | 1,232 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018, by Huba Nagy.
# Copyright, 2018-2025, by Samuel Williams.
require_relative "pipeline"
module Async
module Redis
module Context
# Context for Redis transaction operations using MULTI/EXEC.
class Transaction < Pipeline
# In... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/context/subscription.rb | Ruby | mit | 97 | main | 3,093 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018, by Huba Nagy.
# Copyright, 2018-2025, by Samuel Williams.
require_relative "generic"
module Async
module Redis
module Context
# Context for Redis pub/sub subscription operations.
class Subscription < Generic
MESSAGE = "me... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/context/pipeline.rb | Ruby | mit | 97 | main | 2,517 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019, by David Ortiz.
# Copyright, 2019-2025, by Samuel Williams.
# Copyright, 2022, by Tim Willard.
require_relative "generic"
module Async
module Redis
module Context
# Send multiple commands without waiting for the response, instea... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/protocol/resp2.rb | Ruby | mit | 97 | main | 1,108 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
require "protocol/redis"
module Async
module Redis
# @namespace
module Protocol
# RESP2 protocol implementation for Redis.
module RESP2
# A connection implementation for RESP2 protocol.
clas... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/protocol/authenticated.rb | Ruby | mit | 97 | main | 1,115 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
require "protocol/redis"
module Async
module Redis
module Protocol
# Executes AUTH after the user has established a connection.
class Authenticated
# Authentication has failed for some reason.
clas... |
github | socketry/async-redis | https://github.com/socketry/async-redis | lib/async/redis/protocol/selected.rb | Ruby | mit | 97 | main | 1,057 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
require "protocol/redis"
module Async
module Redis
module Protocol
# Executes AUTH after the user has established a connection.
class Selected
# Authentication has failed for some reason.
class Sel... |
github | socketry/async-redis | https://github.com/socketry/async-redis | examples/redis/pop.rb | Ruby | mit | 97 | main | 436 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
require "async"
require "async/barrier"
require "redis"
Async do |parent|
child = Async do |task|
redis = Redis.new
Console.logger.info(task, "blpop")
puts redis.blpop("mylist")
end... |
github | socketry/async-redis | https://github.com/socketry/async-redis | examples/redis/pres/pop.rb | Ruby | mit | 97 | main | 413 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
require "async"
require "redis"
Async do |parent|
child = Async do |task|
redis = Redis.new
Console.logger.info(task, "blpop")
puts redis.blpop("mylist")
end
redis = Redis.new
C... |
github | socketry/async-redis | https://github.com/socketry/async-redis | examples/slow-log/queues.rb | Ruby | mit | 97 | main | 766 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
require "async"
require_relative "../../lib/async/redis"
endpoint = Async::Redis.local_endpoint(port: 6380)
client = Async::Redis::Client.new(endpoint)
Async do
pipeline = client.pipeline... |
github | socketry/async-redis | https://github.com/socketry/async-redis | examples/slow-log/analysis.rb | Ruby | mit | 97 | main | 953 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
require "set"
require "async"
require_relative "../../lib/async/redis"
endpoint = Async::Redis.local_endpoint(port: 6380)
client = Async::Redis::Client.new(endpoint)
IGNORE = Set["evalsha"... |
github | socketry/async-redis | https://github.com/socketry/async-redis | examples/subscribe/pubsub.rb | Ruby | mit | 97 | main | 817 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2023-2025, by Samuel Williams.
require_relative "../../lib/async/redis"
class Subscription
def initialize(topic, endpoint = Async::Redis.local_endpoint)
@topic = topic
@endpoint = endpoint
@client = nil
end
de... |
github | socketry/async-redis | https://github.com/socketry/async-redis | examples/auth/wrapper.rb | Ruby | mit | 97 | main | 2,324 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021, by Troex Nevelin.
# Copyright, 2023-2025, by Samuel Williams.
require_relative "../../lib/async/redis"
# Friendly client wrapper that supports SSL, AUTH and db SELECT
class AsyncRedisClientWrapper
class << self
# @param url [String... |
github | socketry/async-redis | https://github.com/socketry/async-redis | examples/auth/protocol.rb | Ruby | mit | 97 | main | 662 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2025, by Samuel Williams.
require_relative "../../lib/async/redis"
class AuthenticatedRESP2
def initialize(credentials, protocol: Async::Redis::Protocol::RESP2)
@credentials = credentials
@protocol = protocol
end
def client(st... |
github | socketry/async-redis | https://github.com/socketry/async-redis | sentinel/test/async/redis/sentinel_client.rb | Ruby | mit | 97 | main | 3,767 | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
require "async/clock"
require "async/redis/sentinel_client"
require "sus/fixtures/async"
require "securerandom"
require "openssl"
describe Async::Redis::SentinelClient do
include Sus::Fixtures::Async::Reactor... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | neo4j-core.gemspec | Ruby | mit | 97 | master | 2,250 | lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
require 'neo4j/core/version'
Gem::Specification.new do |s|
s.name = 'neo4j-core'
s.version = Neo4j::Core::VERSION
s.required_ruby_version = '>= 2.1.0'
s.authors = 'Andreas Ronge, Chris Grigg, Brian Underwood'
... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | Rakefile | Ruby | mit | 97 | master | 2,660 | require 'rake'
require 'bundler/gem_tasks'
require 'neo4j/rake_tasks'
require 'yard'
load './spec/lib/yard_rspec.rb'
def jar_path
spec = Gem::Specification.find_by_name('neo4j-community')
gem_root = spec.gem_dir
gem_root + '/lib/neo4j-community/jars'
end
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | Guardfile | Ruby | mit | 97 | master | 1,178 | # A sample Guardfile
# More info at https://github.com/guard/guard#readme
## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec feature)
## Uncomment to clear the screen before every task
# clearing :on
## Guard internally checks for changes in the Guardfil... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | Gemfile | Ruby | mit | 97 | master | 704 | source 'https://rubygems.org'
gemspec
# gem 'neo4j-advanced', '>= 1.8.1', '< 2.0', :require => false
# gem 'neo4j-enterprise', '>= 1.8.1', '< 2.0', :require => false
gem 'tins', '< 1.7' if RUBY_VERSION.to_f < 2.0
group 'development' do
if RUBY_PLATFORM =~ /java/
gem 'neo4j-ruby-driver', path: '../neo4j-ruby... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/ansi.rb | Ruby | mit | 97 | master | 223 | module Neo4j
module ANSI
CLEAR = "\e[0m"
BOLD = "\e[1m"
RED = "\e[31m"
GREEN = "\e[32m"
YELLOW = "\e[33m"
BLUE = "\e[34m"
MAGENTA = "\e[35m"
CYAN = "\e[36m"
WHITE = "\e[37m"
end
end |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/transaction.rb | Ruby | mit | 97 | master | 4,696 | require 'active_support/core_ext/module/delegation'
require 'active_support/per_thread_registry'
module Neo4j
module Transaction
extend self
# Provides a simple API to manage transactions for each session in a thread-safe manner
class TransactionsRegistry
extend ActiveSupport::PerThreadRegistry
... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/cypher_session.rb | Ruby | mit | 97 | master | 748 | require 'active_support/core_ext/module/delegation'
module Neo4j
module Core
class CypherSession
attr_reader :adaptor
delegate :close, to: :adaptor
def initialize(adaptor)
fail ArgumentError, "Invalid adaptor: #{adaptor.inspect}" if !adaptor.is_a?(Adaptors::Base)
@adaptor = ad... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/logging.rb | Ruby | mit | 97 | master | 1,389 | # Copied largely from activerecord/lib/active_record/log_subscriber.rb
module Neo4j
module Core
module Logging
class << self
def first_external_path_and_line(callstack)
line = callstack.find do |frame|
frame.absolute_path && !ignored_callstack(frame.absolute_path)
end... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/helpers.rb | Ruby | mit | 97 | master | 513 | # TODO: Needed?
module Neo4j
module Core
module TxMethods
def tx_methods(*methods)
methods.each do |method|
tx_method = "#{method}_in_tx"
send(:alias_method, tx_method, method)
send(:define_method, method) do |*args, &block|
session = args.last.is_a?(Neo4j::... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/query.rb | Ruby | mit | 97 | master | 15,481 | require 'neo4j/core/query_clauses'
require 'neo4j/core/query_find_in_batches'
require 'active_support/notifications'
module Neo4j
module Core
# Allows for generation of cypher queries via ruby method calls (inspired by ActiveRecord / arel syntax)
#
# Can be used to express cypher queries in ruby nicely, ... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/config.rb | Ruby | mit | 97 | master | 239 | module Neo4j
module Core
module Config
def self.wrapping_level(level = nil)
if level.nil?
@wrapping_level || :core_entity
else
@wrapping_level = level
end
end
end
end
end |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/query_find_in_batches.rb | Ruby | mit | 97 | master | 1,561 | module Neo4j
module Core
module QueryFindInBatches
def find_in_batches(node_var, prop_var, options = {})
validate_find_in_batches_options!(options)
batch_size = options.delete(:batch_size) || 1000
query = reorder(node_var => prop_var).limit(batch_size)
records = query.to_a... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/relationship.rb | Ruby | mit | 97 | master | 917 | require 'neo4j/core/wrappable'
require 'active_support/core_ext/hash/keys'
module Neo4j
module Core
class Relationship
attr_reader :id, :type, :properties, :start_node_id, :end_node_id
alias props properties
alias neo_id id
alias start_node_neo_id start_node_id
alias end_node_neo_id... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/node.rb | Ruby | mit | 97 | master | 797 | require 'neo4j/core/wrappable'
require 'active_support/core_ext/hash/keys'
module Neo4j
module Core
class Node
attr_reader :id, :labels, :properties
alias props properties
include Wrappable
# Perhaps we should deprecate this?
alias neo_id id
def initialize(id, labels, prope... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/path.rb | Ruby | mit | 97 | master | 300 | module Neo4j
module Core
class Path
attr_reader :nodes, :relationships, :directions
include Wrappable
def initialize(nodes, relationships, directions)
@nodes = nodes
@relationships = relationships
@directions = directions
end
end
end
end |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/query_clauses.rb | Ruby | mit | 97 | master | 18,712 | module Neo4j
module Core
module QueryClauses
class ArgError < StandardError
attr_reader :arg_part
def initialize(arg_part = nil)
super
@arg_part = arg_part
end
end
class Clause
UNDERSCORE = '_'
COMMA_SPACE = ', '
AND = ' AND '
... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/rake_tasks_deprecation.rake | Ruby | mit | 97 | master | 730 | namespace :neo4j do
%i[install start start_no_wait console shell config stop info indexes constraints
restart reset_yes_i_am_sure change_password enable_auth disable_auth].each do |task_name|
task task_name do |_, _args|
puts <<-INFO
The `neo4j-rake_tasks` gem is no longer a dependency of the `neo4j-... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/wrappable.rb | Ruby | mit | 97 | master | 705 | module Neo4j
module Core
module Wrappable
def self.included(base)
base.send :include, InstanceMethods
base.extend ClassMethods
end
module InstanceMethods
def wrap
self.class.wrap(self)
end
end
module ClassMethods
def wrapper_callbac... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/instrumentable.rb | Ruby | mit | 97 | master | 1,057 | require 'active_support/notifications'
module Neo4j
module Core
module Instrumentable
def self.included(base)
base.send :include, InstanceMethods
base.extend ClassMethods
end
module InstanceMethods
end
module ClassMethods
def instrument(name, label, argumen... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/label.rb | Ruby | mit | 97 | master | 5,402 | module Neo4j
module Core
class Label
attr_reader :name
def initialize(name, session)
@name = name
@session = session
end
def create_index(property, options = {})
validate_index_options!(options)
properties = property.is_a?(Array) ? property.join(',') : pro... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/cypher_session/responses.rb | Ruby | mit | 97 | master | 906 | require 'neo4j/core/cypher_session/result'
module Neo4j
module Core
class CypherSession
module Responses
MAP = {}
class Base
include Enumerable
def each
results.each do |result|
yield result
end
end
def wrap_by... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/cypher_session/transactions.rb | Ruby | mit | 97 | master | 1,217 | require 'neo4j/transaction'
module Neo4j
module Core
class CypherSession
module Transactions
class Base < Neo4j::Transaction::Base
def query(*args)
options = if args[0].is_a?(::Neo4j::Core::Query)
args[1] ||= {}
else
... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/cypher_session/result.rb | Ruby | mit | 97 | master | 802 | require 'neo4j/core/node'
require 'neo4j/core/relationship'
require 'neo4j/core/path'
module Neo4j
module Core
class CypherSession
class Result
attr_reader :columns, :rows
def initialize(columns, rows)
@columns = columns.map(&:to_sym)
@rows = rows
@struct_clas... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/cypher_session/adaptors.rb | Ruby | mit | 97 | master | 7,262 | require 'neo4j/core/cypher_session'
require 'neo4j/core/instrumentable'
require 'neo4j/core/label'
require 'neo4j/core/version'
require 'neo4j/core/logging'
require 'neo4j/ansi'
module Neo4j
module Core
class CypherSession
class CypherError < StandardError
attr_reader :code, :original_message, :sta... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/cypher_session/transactions/driver.rb | Ruby | mit | 97 | master | 1,348 | require 'neo4j/core/cypher_session/transactions'
module Neo4j
module Core
class CypherSession
module Transactions
class Driver < Base
attr_reader :driver_tx, :driver_session
def initialize(*args)
super
return unless root?
@driver_session = se... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/cypher_session/transactions/bolt.rb | Ruby | mit | 97 | master | 708 | require 'neo4j/core/cypher_session/transactions'
module Neo4j
module Core
class CypherSession
module Transactions
class Bolt < Base
def initialize(*args)
super
tx_query('BEGIN') if root?
end
def commit
tx_query('COMMIT') if root?
... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/cypher_session/transactions/embedded.rb | Ruby | mit | 97 | master | 674 | require 'neo4j/core/cypher_session/transactions'
module Neo4j
module Core
class CypherSession
module Transactions
class Embedded < Base
def initialize(*args)
super
@java_tx = adaptor.graph_db.begin_tx
end
def commit
return if !@java... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/cypher_session/transactions/http.rb | Ruby | mit | 97 | master | 1,301 | require 'neo4j/core/cypher_session/transactions'
module Neo4j
module Core
class CypherSession
module Transactions
class HTTP < Base
# Should perhaps have transaction adaptors only define #close
# commit/delete are, I think, an implementation detail
def commit
... |
github | neo4jrb/neo4j-core | https://github.com/neo4jrb/neo4j-core | lib/neo4j/core/cypher_session/adaptors/driver.rb | Ruby | mit | 97 | master | 3,563 | require 'neo4j/core/cypher_session/adaptors'
require 'neo4j/core/cypher_session/adaptors/has_uri'
require 'neo4j/core/cypher_session/adaptors/schema'
require 'neo4j/core/cypher_session/responses/driver'
require 'singleton'
module Neo4j
module Core
class CypherSession
module Adaptors
# The registry ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.