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
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
lib/sidekiq/prometheus/exporter/version.rb
Ruby
mit
210
master
309
# frozen_string_literal: true module Sidekiq module Prometheus module Exporter # NOTE: Every version update dropds Docker patch version to 0 # and every adjustment in Docker setup bumps it to +1 VERSION = '0.3.0'.freeze DOCKER_PATCH_VERSION = '0'.freeze end end end
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
lib/sidekiq/prometheus/exporter/standard.rb
Ruby
mit
210
master
4,196
# frozen_string_literal: true require 'erb' require 'sidekiq/api' module Sidekiq module Prometheus module Exporter class Standard UNKNOWN_IDENTITY = 'unknown-identity'.freeze BYTES_IN_KILOBYTE = 1024 OMIT_NEWLINES_MODE = '<>'.freeze TEMPLATE = ERB.new( File.read(F...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
lib/sidekiq/prometheus/exporter/cron.rb
Ruby
mit
210
master
534
# frozen_string_literal: true require 'erb' # Exporter for the https://github.com/ondrejbartas/sidekiq-cron module Sidekiq module Prometheus module Exporter class Cron TEMPLATE = ERB.new(File.read(File.expand_path('templates/cron.erb', __dir__))) def self.available? defined?(Sid...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/spec_helper.rb
Ruby
mit
210
master
774
require 'bundler/setup' require 'rack' require 'rack/test' require 'timecop' require 'pry-byebug' Dir[File.expand_path('spec/support/**/*.rb')].sort.each { |file| require file } require 'sidekiq/prometheus/exporter' RSpec.configure do |config| config.include Rack::Test::Methods config.include FixtureMethods ...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/support/sidekiq_process_set_mock.rb
Ruby
mit
210
master
322
# frozen_string_literal: true require 'forwardable' class SidekiqProcessSetMock extend Forwardable include Enumerable def_delegator :@processes, :each def initialize(processes) @processes = processes end def leader raise NotImplementedError, 'please do not use this method without stub' end en...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/support/scheduler/sidekiq_scheduler_mock.rb
Ruby
mit
210
master
502
# frozen_string_literal: true module SidekiqSchedulerMock module Sidekiq def self.schedule! raise NotImplementedError, 'please do not use this method without stub' end class Scheduler def self.job_enabled?(_name) raise NotImplementedError, 'please do not use this method without stub'...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/support/exporter/contrib_mock.rb
Ruby
mit
210
master
251
# frozen_string_literal: true class ContribMock def self.available? raise NotImplementedError, 'please do not use this method without stub' end def to_s raise NotImplementedError, 'please do not use this method without stub' end end
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/support/exporter/standard_mock.rb
Ruby
mit
210
master
252
# frozen_string_literal: true class StandardMock def self.available? raise NotImplementedError, 'please do not use this method without stub' end def to_s raise NotImplementedError, 'please do not use this method without stub' end end
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/support/exporter/unavailable_contrib_mock.rb
Ruby
mit
210
master
262
# frozen_string_literal: true class UnavailableContribMock def self.available? raise NotImplementedError, 'please do not use this method without stub' end def to_s raise NotImplementedError, 'please do not use this method without stub' end end
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/sidekiq-7.x/prometheus/exporter_spec.rb
Ruby
mit
210
master
4,028
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sidekiq::Prometheus::Exporter do let(:app) do # Re-assemble Rack application manually # to be able to to behave like Rack 2.2. # # Related: https://github.com/Strech/sidekiq-prometheus-exporter/issues/21 klass = described_class ...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/sidekiq-7.x/prometheus/exporter/standard_spec.rb
Ruby
mit
210
master
5,261
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sidekiq::Prometheus::Exporter::Standard do describe '#to_s' do let(:exporter) { described_class.new } let(:stats) do instance_double( Sidekiq::Stats, processed: 10, failed: 9, workers_size: 8, enqueued: 7, ...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/sidekiq/prometheus/exporter/cron_spec.rb
Ruby
mit
210
master
571
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sidekiq::Prometheus::Exporter::Cron do describe '#to_s' do let(:exporter) { described_class.new } let(:metrics_text) do <<~TEXT.chomp # HELP sidekiq_cron_jobs The number of cron jobs. # TYPE sidekiq_cron_jobs gauge ...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/sidekiq/prometheus/exporter/exporters_spec.rb
Ruby
mit
210
master
2,002
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sidekiq::Prometheus::Exporter::Exporters do let(:instance) { described_class.new } let(:exporters) do {standard: StandardMock, contrib: ContribMock, unavailable: UnavailableContribMock} end before do stub_const("#{described_class}::AV...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/sidekiq/prometheus/exporter/scheduler_spec.rb
Ruby
mit
210
master
2,718
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sidekiq::Prometheus::Exporter::Scheduler do describe '#to_s' do let(:exporter) { described_class.new } let(:schedule) do { 'job-once-per-day' => { 'description' => 'This job runs every 24 hours', 'every' => ...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/sidekiq-8.x/prometheus/exporter_spec.rb
Ruby
mit
210
master
4,026
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sidekiq::Prometheus::Exporter do let(:app) do # Re-assemble Rack application manually # to be able to to behave like Rack 2.2. # # Related: https://github.com/Strech/sidekiq-prometheus-exporter/issues/21 klass = described_class ...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/sidekiq-8.x/prometheus/exporter/standard_spec.rb
Ruby
mit
210
master
5,254
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sidekiq::Prometheus::Exporter::Standard do describe '#to_s' do let(:exporter) { described_class.new } let(:stats) do instance_double( Sidekiq::Stats, processed: 10, failed: 9, workers_size: 8, enqueued: 7, ...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/sidekiq/prometheus/exporter_spec.rb
Ruby
mit
210
master
3,500
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sidekiq::Prometheus::Exporter do let(:app) do # Re-assemble Rack application manually # to be able to to behave like Rack 2.2. # # Related: https://github.com/Strech/sidekiq-prometheus-exporter/issues/21 klass = described_class ...
github
Strech/sidekiq-prometheus-exporter
https://github.com/Strech/sidekiq-prometheus-exporter
spec/sidekiq/prometheus/exporter/standard_spec.rb
Ruby
mit
210
master
4,733
# frozen_string_literal: true require 'spec_helper' RSpec.describe Sidekiq::Prometheus::Exporter::Standard do describe '#to_s' do let(:exporter) { described_class.new } let(:stats) do instance_double( Sidekiq::Stats, processed: 10, failed: 9, workers_size: 8, enqueued: 7, ...
github
ruby/drb
https://github.com/ruby/drb
Rakefile
Ruby
bsd-2-clause
210
master
556
require "bundler/gem_tasks" require "rake/testtask" Rake::TestTask.new(:test) do |t| t.libs << "test/lib" t.ruby_opts << "-rhelper" t.test_files = FileList["test/**/test_*.rb"] end task :default => :test # Use Trusted Publishing release_task = Rake.application["release"] release_task.prerequisites.delete("buil...
github
ruby/drb
https://github.com/ruby/drb
drb.gemspec
Ruby
bsd-2-clause
210
master
1,188
begin require_relative "lib/drb/version" rescue LoadError # Fallback to load version file in ruby core repository require_relative "version" end Gem::Specification.new do |spec| spec.name = "drb" spec.version = DRb::VERSION spec.authors = ["Masatoshi SEKI"] spec.email = ["seki@...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_array_drbunix.rb
Ruby
bsd-2-clause
210
master
349
# frozen_string_literal: false require 'drb/drb' require 'drb/extserv' if __FILE__ == $0 def ARGV.shift it = super() raise "usage: #{$0} <uri> <name>" unless it it end DRb.start_service('drbunix:', [1, 2, 'III', 4, "five", 6]) es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) DRb.thread.join es.st...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_array.rb
Ruby
bsd-2-clause
210
master
360
# frozen_string_literal: false require 'drb/drb' require 'drb/extserv' if __FILE__ == $0 def ARGV.shift it = super() raise "usage: #{$0} <uri> <name>" unless it it end DRb.start_service('druby://localhost:0', [1, 2, 'III', 4, "five", 6]) es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) DRb.thread.j...
github
ruby/drb
https://github.com/ruby/drb
test/drb/test_drbssl.rb
Ruby
bsd-2-clause
210
master
1,847
# frozen_string_literal: false require_relative 'drbtest' begin require 'drb/ssl' rescue LoadError end module DRbTests if Object.const_defined?("OpenSSL") class DRbSSLService < DRbService %w(ut_drb_drbssl.rb ut_array_drbssl.rb).each do |nm| add_service_command(nm) end def start config = Hash.new ...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_eq.rb
Ruby
bsd-2-clause
210
master
546
# frozen_string_literal: false require 'drb/drb' require 'drb/extserv' module DRbTests class Foo include DRbUndumped end class Bar include DRbUndumped def initialize @foo = Foo.new end attr_reader :foo def foo?(foo) @foo == foo end end end if __FILE__ == $0 def ARGV.shift it = super() ...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_drb_drbunix.rb
Ruby
bsd-2-clause
210
master
451
# frozen_string_literal: false require "#{File.dirname(File.expand_path(__FILE__))}/ut_drb" if __FILE__ == $0 def ARGV.shift it = super() raise "usage: #{$0} <manager-uri> <name>" unless it it end DRb::DRbServer.default_argc_limit(8) DRb::DRbServer.default_load_limit(4096) DRb.start_service('drb...
github
ruby/drb
https://github.com/ruby/drb
test/drb/test_drbunix.rb
Ruby
bsd-2-clause
210
master
927
# frozen_string_literal: false require_relative 'drbtest' begin require 'drb/unix' rescue LoadError end module DRbTests if Object.const_defined?("UNIXServer") class DRbUNIXService < DRbService %w(ut_drb_drbunix.rb ut_array_drbunix.rb).each do |nm| add_service_command(nm) end def start @server = DR...
github
ruby/drb
https://github.com/ruby/drb
test/drb/test_drbobject.rb
Ruby
bsd-2-clause
210
master
1,265
require 'test/unit' require 'envutil' require 'drb' require 'drb/timeridconv' require 'drb/weakidconv' module DRbObjectTest class Foo def initialize @foo = 'foo' end end def teardown DRb.stop_service DRb::DRbConn.stop_pool end def drb_eq(obj) proxy = DRbObject.new(obj) assert_...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_large.rb
Ruby
bsd-2-clause
210
master
1,031
# frozen_string_literal: false require 'drb/drb' require 'drb/extserv' require 'timeout' module DRbTests class DRbLarge include DRbUndumped def size(ary) ary.size end def sum(ary) ary.inject(:+) end def multiply(ary) ary.inject(:*) end def avg(ary) return if ary.empty? if ary.a...
github
ruby/drb
https://github.com/ruby/drb
test/drb/drbtest.rb
Ruby
bsd-2-clause
210
master
9,282
# frozen_string_literal: false require 'test/unit' require 'envutil' require 'drb/drb' require 'drb/extservm' require 'timeout' module DRbTests class DRbService @@ruby = [EnvUtil.rubybin] @@ruby << "-d" if $DEBUG def self.add_service_command(nm) dir = File.dirname(File.expand_path(__FILE__)) DRb::ExtSer...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_safe1.rb
Ruby
bsd-2-clause
210
master
399
# frozen_string_literal: false require 'drb/drb' require 'drb/extserv' if __FILE__ == $0 def ARGV.shift it = super() raise "usage: #{$0} <uri> <name>" unless it it end DRb.start_service('druby://localhost:0', [1, 2, 'III', 4, "five", 6], {:safe_level => 1}) es = DRb::ExtServ.ne...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_drb.rb
Ruby
bsd-2-clause
210
master
2,598
# frozen_string_literal: false require 'drb/drb' require 'drb/extserv' require 'timeout' module DRbTests class XArray < Array def initialize(ary) ary.each do |x| self.push(x) end end end class XArray2 < XArray include DRbUndumped end class Unknown2 def initialize @foo = 'unknown2' end en...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_array_drbssl.rb
Ruby
bsd-2-clause
210
master
1,184
# frozen_string_literal: false require 'drb/drb' require 'drb/extserv' require 'drb/ssl' if __FILE__ == $0 def ARGV.shift it = super() raise "usage: #{$0} <uri> <name>" unless it it end module DRbTests TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_ -----BEGIN DH PARAMETERS----- MIGHAoG...
github
ruby/drb
https://github.com/ruby/drb
test/drb/test_acl.rb
Ruby
bsd-2-clause
210
master
5,355
# frozen_string_literal: false # acltest.rb - ACL unit test # Copyright (c) 2000 Masatoshi SEKI # # acltest.rb is copyrighted free software by Masatoshi SEKI. # You can redistribute it and/or modify it under the same terms as Ruby. require 'test/unit' require 'drb/acl' module DRbTests class SampleHosts def initial...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_timerholder.rb
Ruby
bsd-2-clause
210
master
1,488
# frozen_string_literal: false require 'test/unit' require 'drb/timeridconv' module DRbTests class TimerIdConvTest < Test::Unit::TestCase def test_usecase_01 keeping = 0.1 idconv = DRb::TimerIdConv.new(keeping) key = idconv.to_id(self) assert_equal(key, self.__id__) sleep(keeping) assert_eq...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_drb_drbssl.rb
Ruby
bsd-2-clause
210
master
1,092
# frozen_string_literal: false require_relative "ut_drb" require 'drb/ssl' if __FILE__ == $0 def ARGV.shift it = super() raise "usage: #{$0} <manager-uri> <name>" unless it it end module DRbTests TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_ -----BEGIN DH PARAMETERS----- MIGHAoGBAKnKQ...
github
ruby/drb
https://github.com/ruby/drb
test/drb/ut_port.rb
Ruby
bsd-2-clause
210
master
353
# frozen_string_literal: false require 'drb/drb' require 'drb/extserv' if __FILE__ == $0 def ARGV.shift it = super() raise "usage: #{$0} <uri> <name>" unless it it end DRb.start_service('druby://:8473', [1, 2, 'III', 4, "five", 6]) es = DRb::ExtServ.new(ARGV.shift, ARGV.shift) DRb.thread.join ...
github
ruby/drb
https://github.com/ruby/drb
test/drb/test_drb.rb
Ruby
bsd-2-clause
210
master
7,526
# frozen_string_literal: false require_relative 'drbtest' module DRbTests class TestDRbCore < Test::Unit::TestCase include DRbCore def setup super setup_service 'ut_drb.rb' end end module DRbYield include DRbBase def test_01_one @there.echo_yield_1([]) {|one| assert_equal([], one) }...
github
ruby/drb
https://github.com/ruby/drb
sample/drbc.rb
Ruby
bsd-2-clause
210
master
674
=begin distributed Ruby --- dRuby Sample Client Copyright (c) 1999-2000 Masatoshi SEKI =end require 'drb/drb' class DRbEx2 include DRbUndumped def initialize(n) @n = n end def to_i @n.to_i end end if __FILE__ == $0 there = ARGV.shift unless there $stderr.puts("usage: #{$0} <server_uri>...
github
ruby/drb
https://github.com/ruby/drb
sample/gw_ct.rb
Ruby
bsd-2-clause
210
master
300
require 'drb/drb' class Foo include DRbUndumped def foo(n) n + n end def bar(n) yield(n) + yield(n) end end DRb.start_service(nil) puts DRb.uri ro = DRbObject.new(nil, ARGV.shift) ro[:tcp] = Foo.new gets it = ro[:unix] p [it, it.foo(1)] gets p it.bar('2') {|n| n * 3} gets
github
ruby/drb
https://github.com/ruby/drb
sample/drbssl_s.rb
Ruby
bsd-2-clause
210
master
680
#!/usr/bin/env ruby require 'drb' require 'drb/ssl' here = ARGV.shift || "drbssl://localhost:3456" class HelloWorld include DRbUndumped def hello(name) "Hello, #{name}." end end config = Hash.new config[:verbose] = true begin data = open("sample.key"){|io| io.read } config[:SSLPrivateKey] = OpenSSL::...
github
ruby/drb
https://github.com/ruby/drb
sample/old_tuplespace.rb
Ruby
bsd-2-clause
210
master
3,828
#!/usr/local/bin/ruby # TupleSpace # Copyright (c) 1999-2000 Masatoshi SEKI # You can redistribute it and/or modify it under the same terms as Ruby. class TupleSpace class Template def initialize(list) @list = list @check_idx = [] @list.each_with_index do |x, i| @check_idx.push i if x ...
github
ruby/drb
https://github.com/ruby/drb
sample/gw_cu.rb
Ruby
bsd-2-clause
210
master
329
require 'drb/drb' require 'drb/unix' class Foo include DRbUndumped def foo(n) n + n end def bar(n) yield(n) + yield(n) end end DRb.start_service('drbunix:', nil) puts DRb.uri ro = DRbObject.new(nil, ARGV.shift) ro[:unix] = Foo.new gets it = ro[:tcp] p [it, it.foo(1)] gets p it.bar('2') {|n| n *...
github
ruby/drb
https://github.com/ruby/drb
sample/dbiff.rb
Ruby
bsd-2-clause
210
master
873
# # dbiff.rb - distributed cdbiff (server) # * original: cdbiff by Satoru Takabayashi <http://namazu.org/~satoru/cdbiff> require 'drb/drb' require 'drb/eq' require 'drb/observer' class Biff include DRb::DRbObservable def initialize(filename, interval) super() @filename = filename @interval = interva...
github
ruby/drb
https://github.com/ruby/drb
sample/rindac.rb
Ruby
bsd-2-clause
210
master
318
require 'drb/drb' require 'rinda/rinda' uri = ARGV.shift || raise("usage: #{$0} <server_uri>") DRb.start_service ts = Rinda::TupleSpaceProxy.new(DRbObject.new(nil, uri)) (1..10).each do |n| ts.write(['sum', DRb.uri, n]) end (1..10).each do |n| ans = ts.take(['ans', DRb.uri, n, nil]) p [ans[2], ans[3]] end
github
ruby/drb
https://github.com/ruby/drb
sample/drbch.rb
Ruby
bsd-2-clause
210
master
756
=begin distributed Ruby --- dRuby Sample Client Copyright (c) 1999-2000 Masatoshi SEKI =end require 'drb/drb' require 'drb/http' class DRbEx2 include DRbUndumped def initialize(n) @n = n end def to_i @n.to_i end end if __FILE__ == $0 there = ARGV.shift unless there $stderr.puts("usage:...
github
ruby/drb
https://github.com/ruby/drb
sample/name.rb
Ruby
bsd-2-clause
210
master
1,988
=begin distributed Ruby --- NamedObject Sample Copyright (c) 2000-2001 Masatoshi SEKI =end =begin How to play. * start server Terminal 1 | % ruby name.rb druby://yourhost:7640 | druby://yourhost:7640 | [return] to exit * start client Terminal 2 | % ruby namec.rb druby://yourhost:7640 | #<DRb::DRbObject:0x4...
github
ruby/drb
https://github.com/ruby/drb
sample/dqout.rb
Ruby
bsd-2-clause
210
master
265
=begin distributed Ruby --- fetch Copyright (c) 1999-2000 Masatoshi SEKI =end require 'drb/drb' require 'dqlib' there = ARGV.shift || raise("usage: #{$0} <server_uri>") DRb.start_service queue = DRbObject.new(nil, there) entry = queue.pop puts entry.greeting
github
ruby/drb
https://github.com/ruby/drb
sample/darrayc.rb
Ruby
bsd-2-clause
210
master
652
=begin distributed Ruby --- Array client Copyright (c) 1999-2001 Masatoshi SEKI =end require 'drb/drb' there = ARGV.shift || raise("usage: #{$0} <server_uri>") DRb.start_service(nil, nil) ro = DRbObject.new(nil, there) p ro.size puts "# collect" a = ro.collect { |x| x + x } p a puts "# find" p ro.find { |x| x...
github
ruby/drb
https://github.com/ruby/drb
sample/drbs.rb
Ruby
bsd-2-clause
210
master
856
=begin distributed Ruby --- dRuby Sample Server Copyright (c) 1999-2000,2002 Masatoshi SEKI =end =begin How to play. Terminal 1 | % ruby drbs.rb | druby://yourhost:7640 Terminal 2 | % ruby drbc.rb druby://yourhost:7640 | "hello" | .... =end require 'drb/drb' class DRbEx include DRbUndumped def ini...
github
ruby/drb
https://github.com/ruby/drb
sample/ring_inspect.rb
Ruby
bsd-2-clause
210
master
422
require 'rinda/ring' require 'drb/drb' class Inspector def initialize end def primary Rinda::RingFinger.primary end def list_place Rinda::RingFinger.to_a end def list(idx = -1) if idx < 0 ts = primary else ts = list_place[idx] raise "RingNotFound" unless ts end ...
github
ruby/drb
https://github.com/ruby/drb
sample/drbssl_c.rb
Ruby
bsd-2-clause
210
master
378
#!/usr/bin/env ruby require 'drb' require 'drb/ssl' there = ARGV.shift || "drbssl://localhost:3456" config = Hash.new config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER config[:SSLVerifyCallback] = lambda{|ok,x509_store| p [ok, x509_store.error_string] true } DRb.start_service(nil,nil,config) h = DRbObject.new(...
github
ruby/drb
https://github.com/ruby/drb
sample/namec.rb
Ruby
bsd-2-clause
210
master
479
=begin distributed Ruby --- NamedObject Sample Client Copyright (c) 2000-2001 Masatoshi SEKI =end require 'drb/drb' begin there = ARGV.shift || raise rescue puts "usage: #{$0} <server_uri>" exit 1 end DRb.start_service() ro = DRbObject.new(nil, there) seq = ro["seq"] mutex = ro["mutex"] p seq p mutex mut...
github
ruby/drb
https://github.com/ruby/drb
sample/rindas.rb
Ruby
bsd-2-clause
210
master
321
require 'drb/drb' require 'rinda/rinda' def do_it(v) puts "do_it(#{v})" v + v end uri = ARGV.shift || raise("usage: #{$0} <server_uri>") DRb.start_service ts = Rinda::TupleSpaceProxy.new(DRbObject.new(nil, uri)) while true r = ts.take(['sum', nil, nil]) v = do_it(r[2]) ts.write(['ans', r[1], r[2], v]) end
github
ruby/drb
https://github.com/ruby/drb
sample/dcdbiff.rb
Ruby
bsd-2-clause
210
master
693
# # dcdbiff.rb - distributed cdbiff (client) # * original: cdbiff by Satoru Takabayashi <http://namazu.org/~satoru/cdbiff> require 'drb/drb' require 'drb/eq' class Notify include DRbUndumped def initialize(biff, command) @biff = biff @command = command @biff.add_observer(self) end def update(f...
github
ruby/drb
https://github.com/ruby/drb
sample/drbs-acl.rb
Ruby
bsd-2-clause
210
master
727
=begin distributed Ruby --- dRuby Sample Server Copyright (c) 1999-2000 Masatoshi SEKI =end =begin How to play. Terminal 1 | % ruby drbs.rb | druby://yourhost:7640 Terminal 2 | % ruby drbc.rb druby://yourhost:7640 | "hello" | 6 | 10 =end require 'drb/drb' require 'acl' class DRbEx def initialize ...
github
ruby/drb
https://github.com/ruby/drb
sample/http0serv.rb
Ruby
bsd-2-clause
210
master
2,534
require 'webrick' require 'drb/drb' require_relative 'http0' module DRb module HTTP0 def self.open_server(uri, config) unless /^http:/ =~ uri raise(DRbBadScheme, uri) unless uri =~ /^http:/ raise(DRbBadURI, 'can\'t parse uri:' + uri) end Server.new(uri, config) end cla...
github
ruby/drb
https://github.com/ruby/drb
sample/ring_echo.rb
Ruby
bsd-2-clause
210
master
511
require 'drb/drb' require 'drb/eq' require 'rinda/ring' class RingEcho include DRbUndumped def initialize(name) @name = name end def echo(str) "#{@name}: #{str}" end end DRb.start_service renewer = Rinda::SimpleRenewer.new finder = Rinda::RingFinger.new ts = finder.lookup_ring_any ts.read_all([:n...
github
ruby/drb
https://github.com/ruby/drb
sample/dlogc.rb
Ruby
bsd-2-clause
210
master
265
=begin distributed Ruby --- Log test Copyright (c) 1999-2001 Masatoshi SEKI =end require 'drb/drb' there = ARGV.shift || raise("usage: #{$0} <server_uri>") DRb.start_service ro = DRbObject.new(nil, there) ro.log(123) ro.log("hello") sleep 2 ro.log("wakeup")
github
ruby/drb
https://github.com/ruby/drb
sample/acl.rb
Ruby
bsd-2-clause
210
master
280
require 'drb/acl' list = %w(deny all allow 192.168.1.1 allow ::ffff:192.168.1.2 allow 192.168.1.3 ) addr = ["AF_INET", 10, "lc630", "192.168.1.3"] acl = ACL.new p acl.allow_addr?(addr) acl = ACL.new(list, ACL::DENY_ALLOW) p acl.allow_addr?(addr)
github
ruby/drb
https://github.com/ruby/drb
sample/speedc.rb
Ruby
bsd-2-clause
210
master
352
#!/usr/local/bin/ruby uri = ARGV.shift || raise("usage: #{$0} URI") N = (ARGV.shift || 100).to_i case uri when /^tcpromp:/, /^unixromp:/ require 'romp' client = ROMP::Client.new(uri, false) foo = client.resolve("foo") when /^druby:/ require 'drb/drb' DRb.start_service foo = DRbObject.new(nil, uri) end ...
github
ruby/drb
https://github.com/ruby/drb
sample/dqin.rb
Ruby
bsd-2-clause
210
master
260
=begin distributed Ruby --- store Copyright (c) 1999-2000 Masatoshi SEKI =end require 'drb/drb' require 'dqlib' there = ARGV.shift || raise("usage: #{$0} <server_uri>") DRb.start_service queue = DRbObject.new(nil, there) queue.push(DQEntry.new(DRb.uri))
github
ruby/drb
https://github.com/ruby/drb
sample/holders.rb
Ruby
bsd-2-clause
210
master
823
=begin = How to play. == with timeridconv: % ruby -d holders.rb druby://yourhost:1234 % ruby holderc.rb druby://yourhost:1234 == without timeridconv: % ruby holders.rb druby://yourhost:1234 % ruby holderc.rb druby://yourhost:1234 =end require 'drb/drb' class DRbEx3 include DRbUndumped def ini...
github
ruby/drb
https://github.com/ruby/drb
sample/drbm.rb
Ruby
bsd-2-clause
210
master
888
=begin multiple DRbServer Copyright (c) 1999-2002 Masatoshi SEKI =end =begin How to play. Terminal 1 | % ruby drbm.rb | druby://yourhost:7640 druby://yourhost:7641 Terminal 2 | % ruby drbmc.rb druby://yourhost:7640 druby://yourhost:7641 | [#<DRb::DRbObject .... @uri="druby://yourhost:7640">, "FOO"] | [#<D...
github
ruby/drb
https://github.com/ruby/drb
sample/extserv_test.rb
Ruby
bsd-2-clause
210
master
1,326
=begin dRuby sample Copyright (c) 2000 Masatoshi SEKI = How to play * Terminal 1 % ruby -I. extserv_test.rb server druby://yourhost:12345 * Terminal 2 % ruby -I. extserv_test.rb druby://yourhost:12345 ... =end require 'drb/drb' def ARGV.shift it = super() raise "usage:\nserver: #{$0} server [<uri...
github
ruby/drb
https://github.com/ruby/drb
sample/ring_place.rb
Ruby
bsd-2-clause
210
master
418
require 'drb/drb' require 'rinda/ring' require 'rinda/tuplespace' unless $DEBUG # Run as a daemon... exit!( 0 ) if fork Process.setsid exit!( 0 ) if fork end DRb.start_service(ARGV.shift) ts = Rinda::TupleSpace.new place = Rinda::RingServer.new(ts) if $DEBUG puts DRb.uri DRb.thread.join else STDIN.reo...
github
ruby/drb
https://github.com/ruby/drb
sample/dchats.rb
Ruby
bsd-2-clause
210
master
1,200
=begin distributed Ruby --- chat server Copyright (c) 1999-2000 Masatoshi SEKI =end require 'drb/drb' class ChatEntry include DRbUndumped def initialize(server, there) @server = server @there = there @name = there.name @key = there.key = Time.now end attr :name, true attr :there def sa...
github
ruby/drb
https://github.com/ruby/drb
sample/gw_s.rb
Ruby
bsd-2-clause
210
master
221
require 'drb/drb' require 'drb/unix' require 'drb/gw' DRb.install_id_conv(DRb::GWIdConv.new) gw = DRb::GW.new s1 = DRb::DRbServer.new(ARGV.shift, gw) s2 = DRb::DRbServer.new(ARGV.shift, gw) s1.thread.join s2.thread.join
github
ruby/drb
https://github.com/ruby/drb
sample/dhasen.rb
Ruby
bsd-2-clause
210
master
596
=begin distributed Ruby --- dRuby Sample Server --- chasen server Copyright (c) 1999-2001 Masatoshi SEKI =end =begin How to play. Terminal 1 | % ruby dhasen.rb | druby://yourhost:7640 Terminal 2 | % ruby dhasenc.rb druby://yourhost:7640 =end require 'drb/drb' require 'chasen' class Dhasen include DRbUn...
github
ruby/drb
https://github.com/ruby/drb
sample/holderc.rb
Ruby
bsd-2-clause
210
master
274
require 'drb/drb' begin there = ARGV.shift || raise rescue $stderr.puts("usage: #{$0} <server_uri>") exit 1 end DRb.start_service() ro = DRbObject.new(nil, there) ary = [] 10.times do ary.push(ro.gen) end sleep 5 if $DEBUG ary.each do |e| p e.sample([1]) end
github
ruby/drb
https://github.com/ruby/drb
sample/speeds.rb
Ruby
bsd-2-clause
210
master
456
class Foo attr_reader :i def initialize @i = 0 end def foo(i) @i = i i + i end end # server = ROMP::Server.new('tcpromp://localhost:4242', nil, true) uri = ARGV.shift || raise("usage: #{$0} URI") foo = Foo.new case uri when /^tcpromp:/, /^unixromp:/ require 'romp' server = ROMP::Server.ne...
github
ruby/drb
https://github.com/ruby/drb
sample/dlogd.rb
Ruby
bsd-2-clause
210
master
617
=begin distributed Ruby --- Log server Copyright (c) 1999-2000 Masatoshi SEKI =end require 'drb/drb' class Logger def initialize(fname) @fname = fname.to_s @fp = File.open(@fname, "a+") @queue = Thread::Queue.new @th = Thread.new { self.flush } end def log(str) @queue.push("#{Time.now}\t...
github
ruby/drb
https://github.com/ruby/drb
sample/dhasenc.rb
Ruby
bsd-2-clause
210
master
417
# -*- coding: utf-8 -*- =begin distributed Ruby --- dRuby Sample Client -- chasen client Copyright (c) 1999-2001 Masatoshi SEKI =end require 'drb/drb' there = ARGV.shift || raise("usage: #{$0} <server_uri>") DRb.start_service dhasen = DRbObject.new(nil, there) print dhasen.sparse("本日は、晴天なり。", "-F", '(%BB %m %M)\n...
github
ruby/drb
https://github.com/ruby/drb
sample/drbmc.rb
Ruby
bsd-2-clause
210
master
399
=begin multiple DRbServer client Copyright (c) 1999-2002 Masatoshi SEKI =end require 'drb/drb' if __FILE__ == $0 s1 = ARGV.shift s2 = ARGV.shift unless s1 && s2 $stderr.puts("usage: #{$0} <server_uri1> <server_uri2>") exit 1 end DRb.start_service() r1 = DRbObject.new(nil, s1) r2 = DRbObject...
github
ruby/drb
https://github.com/ruby/drb
sample/dchatc.rb
Ruby
bsd-2-clause
210
master
699
=begin distributed Ruby --- chat client Copyright (c) 1999-2000 Masatoshi SEKI =end require 'drb/drb' class ChatClient include DRbUndumped def initialize(name) @name = name @key = nil end attr_reader(:name) attr_accessor(:key) def message(there, str) raise 'invalid key' unless @key == the...
github
ruby/drb
https://github.com/ruby/drb
sample/darray.rb
Ruby
bsd-2-clause
210
master
202
=begin distributed Ruby --- Array Copyright (c) 1999-2001 Masatoshi SEKI =end require 'drb/drb' here = ARGV.shift DRb.start_service(here, [1, 2, "III", 4, "five", 6]) puts DRb.uri DRb.thread.join
github
ruby/drb
https://github.com/ruby/drb
sample/simpletuple.rb
Ruby
bsd-2-clause
210
master
1,555
#!/usr/local/bin/ruby # SimpleTupleSpace # Copyright (c) 1999-2000 Masatoshi SEKI # You can redistribute it and/or modify it under the same terms as Ruby. class SimpleTupleSpace def initialize @hash = {} @waiting = {} @hash.taint @waiting.taint self.taint end def out(key, obj) Thread.cri...
github
ruby/drb
https://github.com/ruby/drb
sample/http0.rb
Ruby
bsd-2-clause
210
master
1,716
require 'drb/drb' require 'net/http' require 'uri' module DRb module HTTP0 class StrStream def initialize(str='') @buf = str end attr_reader :buf def read(n) begin return @buf[0,n] ensure @buf[0,n] = '' end end def write(s)...
github
ruby/drb
https://github.com/ruby/drb
lib/drb/observer.rb
Ruby
bsd-2-clause
210
master
671
# frozen_string_literal: false require 'observer' module DRb # The Observable module extended to DRb. See Observable for details. module DRbObservable include Observable # Notifies observers of a change in state. See also # Observable#notify_observers def notify_observers(*arg) if defined?...
github
ruby/drb
https://github.com/ruby/drb
lib/drb/extservm.rb
Ruby
bsd-2-clause
210
master
1,847
# frozen_string_literal: false =begin external service manager Copyright (c) 2000 Masatoshi SEKI =end require_relative 'drb' require 'monitor' module DRb class ExtServManager include DRbUndumped include MonitorMixin @@command = {} def self.command @@command end def self.com...
github
ruby/drb
https://github.com/ruby/drb
lib/drb/eq.rb
Ruby
bsd-2-clause
210
master
275
# frozen_string_literal: false module DRb class DRbObject # :nodoc: def ==(other) return false unless DRbObject === other (@ref == other.__drbref) && (@uri == other.__drburi) end def hash [@uri, @ref].hash end alias eql? == end end
github
ruby/drb
https://github.com/ruby/drb
lib/drb/unix.rb
Ruby
bsd-2-clause
210
master
2,843
# frozen_string_literal: false require 'socket' require_relative 'drb' require 'tmpdir' raise(LoadError, "UNIXServer is required") unless defined?(UNIXServer) module DRb # Implements DRb over a UNIX socket # # DRb UNIX socket URIs look like <code>drbunix:<path>?<option></code>. The # option is optional. ...
github
ruby/drb
https://github.com/ruby/drb
lib/drb/weakidconv.rb
Ruby
bsd-2-clause
210
master
784
# frozen_string_literal: false require_relative 'drb' module DRb # DRb::WeakIdConv is deprecated since 2.2.1. You don't need to use # DRb::WeakIdConv instead of DRb::DRbIdConv. It's the same class. # # This file still exists for backward compatibility. # # To use WeakIdConv: # # DRb.start_service(nil...
github
ruby/drb
https://github.com/ruby/drb
lib/drb/acl.rb
Ruby
bsd-2-clause
210
master
4,721
# frozen_string_literal: false # Copyright (c) 2000,2002,2003 Masatoshi SEKI # # acl.rb is copyrighted free software by Masatoshi SEKI. # You can redistribute it and/or modify it under the same terms as Ruby. require 'ipaddr' ## # Simple Access Control Lists. # # Access control lists are composed of "allow" and "deny...
github
ruby/drb
https://github.com/ruby/drb
lib/drb/ssl.rb
Ruby
bsd-2-clause
210
master
12,192
# frozen_string_literal: false require 'socket' require 'openssl' require_relative 'drb' require 'singleton' module DRb # The protocol for DRb over an SSL socket # # The URI for a DRb socket over SSL is: # <code>drbssl://<host>:<port>?<option></code>. The option is optional class DRbSSLSocket < DRbTCPSocke...
github
ruby/drb
https://github.com/ruby/drb
lib/drb/drb.rb
Ruby
bsd-2-clause
210
master
60,172
# frozen_string_literal: false # # = drb/drb.rb # # Distributed Ruby: _dRuby_ # # Copyright (c) 1999-2003 Masatoshi SEKI. You can redistribute it and/or # modify it under the same terms as Ruby. # # Author:: Masatoshi SEKI # # Documentation:: William Webber (william@williamwebber.com) # # == Overview # # dRuby is a di...
github
ruby/drb
https://github.com/ruby/drb
lib/drb/gw.rb
Ruby
bsd-2-clause
210
master
3,077
# frozen_string_literal: false require_relative 'drb' require 'monitor' module DRb # Gateway id conversion forms a gateway between different DRb protocols or # networks. # # The gateway needs to install this id conversion and create servers for # each of the protocols or networks it will be a gateway betwee...
github
ruby/drb
https://github.com/ruby/drb
lib/drb/timeridconv.rb
Ruby
bsd-2-clause
210
master
2,213
# frozen_string_literal: false require_relative 'drb' require 'monitor' module DRb # Timer id conversion keeps objects alive for a certain amount of time after # their last access. The default time period is 600 seconds and can be # changed upon initialization. # # To use TimerIdConv: # # DRb.install_...
github
ruby/drb
https://github.com/ruby/drb
lib/drb/extserv.rb
Ruby
bsd-2-clause
210
master
840
# frozen_string_literal: false =begin external service Copyright (c) 2000,2002 Masatoshi SEKI =end require_relative 'drb' require 'monitor' module DRb class ExtServ include MonitorMixin include DRbUndumped def initialize(there, name, server=nil) super() @server = server || DRb::pri...
github
kenn/jquery-rails-cdn
https://github.com/kenn/jquery-rails-cdn
Rakefile
Ruby
mit
209
master
207
#!/usr/bin/env rake require 'bundler/gem_tasks' require 'rake/testtask' Rake::TestTask.new do |t| t.libs << 'test' t.test_files = FileList['test/test*.rb'] t.verbose = true end task :default => :test
github
kenn/jquery-rails-cdn
https://github.com/kenn/jquery-rails-cdn
jquery-rails-cdn.gemspec
Ruby
mit
209
master
797
# -*- encoding: utf-8 -*- require File.expand_path('../lib/jquery-rails-cdn/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Kenn Ejima"] gem.email = ["kenn.ejima@gmail.com"] gem.description = %q{Add CDN support to jquery-rails} gem.summary = %q{Add CDN support to jquer...
github
kenn/jquery-rails-cdn
https://github.com/kenn/jquery-rails-cdn
lib/jquery-rails-cdn.rb
Ruby
mit
209
master
1,919
require 'jquery-rails' require 'jquery-rails-cdn/version' module Jquery::Rails module Cdn mattr_accessor :major_version OFFLINE = (Rails.env.development? or Rails.env.test?) URL = { :google => "//ajax.googleapis.com/ajax/libs/jquery/{JQUERY_VERSION}/jquery.min.js", :microsoft => "//aj...
github
kenn/jquery-rails-cdn
https://github.com/kenn/jquery-rails-cdn
test/test_cdn.rb
Ruby
mit
209
master
1,900
require 'rails' require 'action_view' require 'jquery-rails-cdn' require 'minitest/autorun' class ActionView::Base include Jquery::Rails::Cdn end class TestCdn < Minitest::Test def test_env assert Rails.env == 'development' end class One < Minitest::Test def setup Jquery::Rails::Cdn.major_versi...
github
ankane/mainstreet
https://github.com/ankane/mainstreet
mainstreet.gemspec
Ruby
mit
209
master
568
require_relative "lib/mainstreet/version" Gem::Specification.new do |spec| spec.name = "mainstreet" spec.version = MainStreet::VERSION spec.summary = "Address verification for Ruby and Rails" spec.homepage = "https://github.com/ankane/mainstreet" spec.license = "MIT" spec.a...
github
ankane/mainstreet
https://github.com/ankane/mainstreet
lib/mainstreet.rb
Ruby
mit
209
master
633
# dependencies require "geocoder" # modules require_relative "mainstreet/address_verifier" require_relative "mainstreet/version" module MainStreet class << self attr_writer :lookup def lookup @lookup ||= ENV["SMARTY_STREETS_AUTH_ID"] ? :smarty_streets : nil end end end if ENV["SMARTY_STREETS_A...
github
ankane/mainstreet
https://github.com/ankane/mainstreet
lib/mainstreet/address_verifier.rb
Ruby
mit
209
master
2,143
module MainStreet class AddressVerifier def initialize(address, country: nil, locale: nil) @address = address @country = country @locale = locale end def success? failure_message.nil? end def failure_message if !result message :unconfirmed, "Address can't be...
github
ankane/mainstreet
https://github.com/ankane/mainstreet
lib/mainstreet/model.rb
Ruby
mit
209
master
1,328
module MainStreet module Model def validates_address(fields:, geocode: false, country: nil, **options) fields = Array(fields.map(&:to_s)) geocode_options = {latitude: :latitude, longitude: :longitude} geocode_options = geocode_options.merge(geocode) if geocode.is_a?(Hash) options[:if] ||= ...
github
ankane/mainstreet
https://github.com/ankane/mainstreet
test/model_test.rb
Ruby
mit
209
master
1,020
require_relative "test_helper" class ModelTest < Minitest::Test def test_success address = Address.new( street: "1 Infinite Loop", city: "Cupertino", region: "CA", postal_code: "95014" ) assert address.valid? assert_in_delta 37.3319, address.latitude, 0.01 assert_in_delta ...
github
ankane/mainstreet
https://github.com/ankane/mainstreet
test/test_helper.rb
Ruby
mit
209
master
1,353
require "bundler/setup" require "active_record" Bundler.require(:default) require "minitest/autorun" require "vcr" require "webmock" def smarty_streets? !ENV["SMARTY_STREETS_AUTH_ID"].nil? end I18n.load_path << Dir[File.expand_path("locales", __dir__) + "/*.yml"] VCR.configure do |c| c.hook_into :webmock c.cas...
github
ankane/mainstreet
https://github.com/ankane/mainstreet
test/address_verifier_test.rb
Ruby
mit
209
master
1,763
require_relative "test_helper" class AddressVerifierTest < Minitest::Test def test_success address = "1 Infinite Loop, Cupertino, CA 95014" verifier = MainStreet::AddressVerifier.new(address) assert verifier.success? assert_nil verifier.failure_message assert_in_delta 37.3319, verifier.latitude, ...
github
MartinJNash/Royce
https://github.com/MartinJNash/Royce
Gemfile
Ruby
mit
209
master
531
source "https://rubygems.org" # Declare your gem's dependencies in roller.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # Declare any dependencies that are still in development here instead of in # ...