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
namusyaka/gammo
https://github.com/namusyaka/gammo
lib/gammo/tags/table.rb
Ruby
mit
197
master
21,556
# Code generated by rake generate; DO NOT EDIT. module Gammo module Tags A = 'a'.freeze Abbr = 'abbr'.freeze Address = 'address'.freeze Area = 'area'.freeze Article = 'article'.freeze Aside = 'aside'.freeze Audio = 'audio'.freeze B = 'b'.freeze Base = 'base'.freeze Bdi = 'bdi'....
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/xpath_test.rb
Ruby
mit
197
master
1,018
require 'test_helper' class XPathTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <!DOCTYPE html> <html> <head> <title>hello</title> <meta charset="utf8"> </head> <body> <div><div><img src="hoge.jpg">A</div></div> <ul class="container"> <li>foo</li> </ul> EOS end test 'traverses DOM t...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/test_helper.rb
Ruby
mit
197
master
300
require 'simplecov' SimpleCov.start do project_name 'gammo' minimum_coverage 90 coverage_dir '.coverage' add_filter '/test/' end $LOAD_PATH.unshift File.expand_path("../lib", __dir__) $LOAD_PATH.unshift __dir__ require "test/unit" require "gammo" module XPath end module CSSSelector end
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/html5lib_test.rb
Ruby
mit
197
master
3,671
$LOAD_PATH.unshift File.expand_path(__dir__) require 'test_helper' require 'support/dump' class HTML5LibTest < Test::Unit::TestCase include Support::Dump def message_for(path, got, want, input, i) msg = "#{path} ##{i} '#{input}', got vs want:\n" msg << ?- * 5 << ?\n msg << got msg << ?- * 5 << ?\n...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/gammo_test.rb
Ruby
mit
197
master
244
require "test_helper" class GammoTest < Test::Unit::TestCase test 'has a version number' do refute_nil ::Gammo::VERSION end test '#new constructs a parser' do assert Gammo::Parser.new('</').instance_of?(Gammo::Parser) end end
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/css_selector_test.rb
Ruby
mit
197
master
420
require 'test_helper' class CSSSelectorTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <!DOCTYPE html> <html> <head> <title>hello</title> <meta charset="utf8"> </head> <body> <div><div><img src="hoge.jpg">A</div></div> <ul class="container"> <li>foo</li> </ul> EOS end test 'traverses...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/attributes_test.rb
Ruby
mit
197
master
1,771
require "test_helper" class AttributesTest < Test::Unit::TestCase setup do @attributes = Gammo::Attributes.new([Gammo::Attribute.new(key: :a, value: :b)]) end test 'reference' do assert_equal :b, @attributes[:a] end test 'setter' do @attributes[:c] = :d assert_equal :d, @attributes[:c] en...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/css_selector/combinator_test.rb
Ruby
mit
197
master
2,606
$LOAD_PATH.unshift File.join(__dir__, '..') require 'test_helper' class CSSSelector::CombinatorTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <!DOCTYPE html> <html> <head> <title>hello</title> <meta charset="utf8"> </head> <body> <div><div><img src="hoge.jpg">A</div></div> <ul class="contai...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/css_selector/selector_test.rb
Ruby
mit
197
master
9,243
$LOAD_PATH.unshift File.join(__dir__, '..') require 'test_helper' class CSSSelector::PredicateTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <!DOCTYPE html> <html> <head> <title>hello</title> <meta charset="utf8"> </head> <body> <div><div><img src="hoge.jpg">A</div></div> <ul class="contain...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/support/dump.rb
Ruby
mit
197
master
2,251
module Support module Dump def dump_indent(level) "| #{' ' * 2 * level}" end def dump_level(buf, node, level) buf << dump_indent(level) level += 1 case node when Gammo::Node::Error raise 'unexpected error node' when Gammo::Node::Text buf << ('"%s"' % no...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/xpath/function_test.rb
Ruby
mit
197
master
1,890
$LOAD_PATH.unshift File.join(__dir__, '..') require 'test_helper' class XPath::FunctionTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <!DOCTYPE html lang="ja"> <html> <head> <title>a</title> </head> <body> <ul> <li>a</li> <li>b</li> <li>c</li> </u...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/xpath/operator_test.rb
Ruby
mit
197
master
2,697
$LOAD_PATH.unshift File.join(__dir__, '..') require 'test_helper' class XPath::OperatorTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <!DOCTYPE html> <html> <head> <title>hello</title> <meta charset="utf8"> </head> <body> <div id="foo">world</div> <div id="bar">baz</div> <select> <option na...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/xpath/axis_test.rb
Ruby
mit
197
master
3,343
$LOAD_PATH.unshift File.join(__dir__, '..') require 'test_helper' class XPath::AxisTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <!DOCTYPE html> <html> <head> <title>hello</title> <meta charset="utf8"> </head> <body> <div><div><img src="hoge.jpg">A</div></div> <ul class="container"> <li>fo...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/xpath/expressions_test.rb
Ruby
mit
197
master
619
$LOAD_PATH.unshift File.join(__dir__, '..') require 'test_helper' class XPath::ExpressionsTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <!DOCTYPE html> <html> <head> <title>hello</title> <meta charset="utf8"> </head> <body> <li>hello</li> <ul> </ul> <p>world</p> </body> </html> EOS e...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/xpath/predicate_test.rb
Ruby
mit
197
master
490
$LOAD_PATH.unshift File.join(__dir__, '..') require 'test_helper' class XPath::PredicateTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <ul> <li>a</li> <li>b</li> <li>c</li> </ul> EOS end test 'predicate' do assert_equal 'abc', 3.times.map { |n| @doc.xpath("//li[#{n + 1}]").firs...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/xpath/node_test_test.rb
Ruby
mit
197
master
812
$LOAD_PATH.unshift File.join(__dir__, '..') require 'test_helper' class XPath::NodeTestTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <!DOCTYPE html> <html> <head> <!-- comment! --> <title>hello</title> </head> <body> </body> </html> EOS end test 'node' do ns = @doc.xpath('//ti...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/xpath/value_test.rb
Ruby
mit
197
master
3,380
$LOAD_PATH.unshift File.join(__dir__, '..') require 'test_helper' class XPath::ValueTest < Test::Unit::TestCase setup do @doc = Gammo.new('').parse end test '#evaluate' do b = Gammo::XPath::AST::Value::Boolean.new(true) assert_equal b, b.evaluate(nil) end test 'node set' do ns = Gammo::XPa...
github
namusyaka/gammo
https://github.com/namusyaka/gammo
test/xpath/filter_test.rb
Ruby
mit
197
master
781
$LOAD_PATH.unshift File.join(__dir__, '..') require 'test_helper' class XPath::FilterTest < Test::Unit::TestCase setup do @doc = Gammo.new(<<-EOS).parse <!DOCTYPE html lang="ja"> <html> <head> <title>a</title> </head> <body> <p class="foo" id="foo">hello</p> <p class="foo" id="fo...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
Rakefile
Ruby
apache-2.0
196
master
901
# Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ begin require 'voxpupuli/test/rake' rescue LoadError # only available if gem group test is installed end begin require 'voxpupuli/acceptance/rake' rescue LoadError # only available if gem group acceptanc...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
lib/facter/pip_version.rb
Ruby
apache-2.0
196
master
576
# frozen_string_literal: true # Make pip version available as a fact def get_pip_version(executable) if Facter::Util::Resolution.which(executable) # rubocop:disable Style/GuardClause results = Facter::Util::Resolution.exec("#{executable} --version 2>&1").match(%r{^pip (\d+\.\d+\.?\d*).*$}) results[1] if res...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
lib/facter/python_release.rb
Ruby
apache-2.0
196
master
755
# frozen_string_literal: true # Make python release available as facts def get_python_release(executable) if Facter::Util::Resolution.which(executable) # rubocop:disable Style/GuardClause results = Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(%r{^.*(\d+\.\d+)\.\d+\+?$}) results[1] if results...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
lib/facter/python_version.rb
Ruby
apache-2.0
196
master
756
# frozen_string_literal: true # Make python versions available as facts def get_python_version(executable) if Facter::Util::Resolution.which(executable) # rubocop:disable Style/GuardClause results = Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(%r{^.*(\d+\.\d+\.\d+\+?)$}) results[1] if result...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/unit/facter/python_release_spec.rb
Ruby
apache-2.0
196
master
3,451
# frozen_string_literal: true require 'spec_helper' describe Facter::Util::Fact do before do Facter.clear end let(:python2_version_output) do <<~EOS Python 2.7.9 EOS end let(:python3_version_output) do <<~EOS Python 3.3.0 EOS end describe 'python_release' do context...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/unit/facter/pip_version_spec.rb
Ruby
apache-2.0
196
master
2,427
# frozen_string_literal: true require 'spec_helper' describe Facter::Util::Fact do before do Facter.clear end let(:pip_version_output) do <<~EOS pip 6.0.6 from /opt/boxen/homebrew/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg (python ...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/unit/facter/python_version_spec.rb
Ruby
apache-2.0
196
master
3,383
# frozen_string_literal: true require 'spec_helper' describe Facter::Util::Fact do before do Facter.clear end let(:python2_version_output) do <<~EOS Python 2.7.9 EOS end let(:python3_version_output) do <<~EOS Python 3.3.0 EOS end describe 'python_version' do context...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/type_aliases/venv/pipversion_spec.rb
Ruby
apache-2.0
196
master
1,004
# frozen_string_literal: true require 'spec_helper' describe 'Python::Venv::PipVersion' do describe 'valid values' do [ '< 1', '< 0.1', '< 1.2.3', '< 1.2.3.40', '<= 1', '<= 0.1', '<= 1.2.3', '<= 1.2.3.40', '> 1', '> 0.1', '> 1.2.3', '> 1.2....
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/acceptance/declared_requirements_install_spec.rb
Ruby
apache-2.0
196
master
618
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'requirements' do it 'checks declared requirements file is installed to venv' do pp = <<-EOS file { '/tmp/requirements.txt': ensure => 'present', content => 'requests', } python::pyvenv { '/tmp/pyvenv': ensur...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/acceptance/pip_spec.rb
Ruby
apache-2.0
196
master
3,610
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'python::pip defined resource' do context 'install package with custom name' do it 'works with no errors' do pp = <<-PUPPET class { 'python': dev => 'present', } python::pyvenv { '/opt/test-venv': en...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/acceptance/pyvenv_spec.rb
Ruby
apache-2.0
196
master
6,327
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'python::pyvenv defined resource with python 3' do context 'minimal parameters' do # Using puppet_apply as a helper it 'works with no errors' do pp = <<-PUPPET class { 'python': dev => 'present', venv => 'pr...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/acceptance/class_spec.rb
Ruby
apache-2.0
196
master
1,237
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'python class' do context 'default parameters' do # Using puppet_apply as a helper it 'works with no errors' do pp = 'include python' # Run it twice and test for idempotency apply_manifest(pp, catch_failures: true) ...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/acceptance/facts_test_spec.rb
Ruby
apache-2.0
196
master
1,258
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'python class' do context 'facts' do install_python = <<-EOS class { 'python' : pip => 'present', } EOS fact_notices = <<-EOS notify{"pip_version: ${facts['pip_version']}":} notify{"system_pyt...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/classes/python_spec.rb
Ruby
apache-2.0
196
master
16,120
# frozen_string_literal: true require 'spec_helper' describe 'python' do on_supported_os.each do |os, facts| next if os == 'gentoo-3-x86_64' context "on #{os}" do let :facts do facts end context 'with defaults' do it { is_expected.to compile.with_all_deps } it { is...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/defines/requirements_spec.rb
Ruby
apache-2.0
196
master
2,159
# frozen_string_literal: true require 'spec_helper' describe 'python::requirements', type: :define do on_supported_os.each do |os, facts| context "on #{os}" do let :facts do facts end let :title do '/requirements.txt' end context 'with /requirements.txt' do ...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/defines/dotfile_spec.rb
Ruby
apache-2.0
196
master
2,428
# frozen_string_literal: true require 'spec_helper' describe 'python::dotfile', type: :define do on_supported_os.each do |os, facts| context("on #{os}") do let :facts do facts end let(:root_group) do if facts[:os]['family'] == 'FreeBSD' 'wheel' else ...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/defines/pyvenv_spec.rb
Ruby
apache-2.0
196
master
2,809
# frozen_string_literal: true require 'spec_helper' describe 'python::pyvenv', type: :define do on_supported_os.each do |os, facts| next if os == 'gentoo-3-x86_64' let :title do '/opt/env' end context "on #{os}" do context 'with default parameters' do let :facts do fa...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/defines/pip_spec.rb
Ruby
apache-2.0
196
master
8,175
# frozen_string_literal: true require 'spec_helper' # rubocop:disable RSpec/MultipleDescribes # rubocop:disable RSpec/RepeatedExampleGroupDescription describe 'python::pip', type: :define do let(:title) { 'rpyc' } context 'on Debian OS' do let :facts do { id: 'root', kernel: 'Linux', ...
github
voxpupuli/puppet-python
https://github.com/voxpupuli/puppet-python
spec/defines/gunicorn_spec.rb
Ruby
apache-2.0
196
master
1,749
# frozen_string_literal: true require 'spec_helper' describe 'python::gunicorn', type: :define do let(:title) { 'test-app' } on_supported_os.each do |os, facts| context "on #{os}" do let(:facts) { facts } describe 'test-app with default parameter values' do context 'configures test app w...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
Gemfile
Ruby
mit
196
master
543
source 'https://rubygems.org' gemspec gem 'rake', '>= 12.3.3' gem 'minitest' gem 'parallel' gem 'single_cov' gem 'minitest-matchers' gem 'yard', '~> 0.9.20' gem 'climate_control', '~> 0.2.0' if RUBY_VERSION >= '2.3.0' gem 'allocation_stats' end group :development do gem 'benchmark-ips' gem 'benchmark-memory' ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
Rakefile
Ruby
mit
196
master
399
require 'bundler/setup' require 'bundler/gem_tasks' require 'rake/testtask' require 'yard' task default: [:spec, :rubocop] begin require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) # rubocop:disable Lint/HandleExceptions rescue LoadError # rubocop:enable Lint/HandleExceptions end namespace :build...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
dogstatsd-ruby.gemspec
Ruby
mit
196
master
1,191
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__) require "datadog/statsd" Gem::Specification.new do |s| s.name = "dogstatsd-ruby" s.version = Datadog::Statsd::VERSION s.authors = ["Rein Henrichs", "Karim Bogtob"] s.summary = "A Ruby DogStatsd client" s.description = "A Ruby DogStatsd client" s.ema...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd.rb
Ruby
mit
196
master
20,187
# frozen_string_literal: true require 'socket' require_relative 'statsd/version' require_relative 'statsd/telemetry' require_relative 'statsd/udp_connection' require_relative 'statsd/uds_connection' require_relative 'statsd/connection_cfg' require_relative 'statsd/origin_detection' require_relative 'statsd/message_buf...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/telemetry.rb
Ruby
mit
196
master
3,919
# frozen_string_literal: true require 'time' module Datadog class Statsd class Telemetry attr_reader :metrics attr_reader :events attr_reader :service_checks attr_reader :bytes_sent attr_reader :bytes_dropped attr_reader :bytes_dropped_queue attr_reader :bytes_dropped_wr...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/uds_connection.rb
Ruby
mit
196
master
1,463
# frozen_string_literal: true require_relative 'connection' module Datadog class Statsd class UDSConnection < Connection class BadSocketError < StandardError; end # DogStatsd unix socket path attr_reader :socket_path def initialize(socket_path, **kwargs) super(**kwargs) ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/sender.rb
Ruby
mit
196
master
6,475
# frozen_string_literal: true module Datadog class Statsd # Sender is using a companion thread to flush and pack messages # in a `MessageBuffer`. # The communication with this thread is done using a `Queue`. # If the thread is dead, it is starting a new one to avoid having a blocked # Sender with...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/message_buffer.rb
Ruby
mit
196
master
2,724
# frozen_string_literal: true module Datadog class Statsd class MessageBuffer PAYLOAD_SIZE_TOLERANCE = 0.05 def initialize(connection, max_payload_size: nil, max_pool_size: DEFAULT_BUFFER_POOL_SIZE, overflowing_stategy: :drop, serializer: ) raise Argumen...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/timer.rb
Ruby
mit
196
master
1,351
# frozen_string_literal: true module Datadog class Statsd class Timer def initialize(interval, &callback) @mx = Mutex.new @cv = ConditionVariable.new @interval = interval @callback = callback @stop = true @thread = nil end def start retur...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/single_thread_sender.rb
Ruby
mit
196
master
2,175
# frozen_string_literal: true module Datadog class Statsd # The SingleThreadSender is a sender synchronously buffering messages # in a `MessageBuffer`. # It is using current Process.PID to check it is the result of a recent fork # and it is reseting the MessageBuffer if that's the case. class Sin...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/forwarder.rb
Ruby
mit
196
master
3,639
# frozen_string_literal: true module Datadog class Statsd class Forwarder attr_reader :telemetry attr_reader :transport_type def initialize( connection_cfg: nil, buffer_max_payload_size: nil, buffer_max_pool_size: nil, buffer_overflowing_stategy: :drop, ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/udp_connection.rb
Ruby
mit
196
master
1,065
# frozen_string_literal: true require_relative 'connection' module Datadog class Statsd class UDPConnection < Connection # StatsD host. attr_reader :host # StatsD port. attr_reader :port def initialize(host, port, **kwargs) super(**kwargs) @host = host @p...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/origin_detection.rb
Ruby
mit
196
master
4,384
# frozen_string_literal: true module Datadog class Statsd private CGROUPV1BASECONTROLLER = "memory" HOSTCGROUPNAMESPACEINODE = 0xEFFFFFFB def host_cgroup_namespace? stat = File.stat("/proc/self/ns/cgroup") rescue nil return false unless stat stat.ino == HOSTCGROUPNAMESPACEINODE ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/serialization.rb
Ruby
mit
196
master
405
# frozen_string_literal: true module Datadog class Statsd module Serialization end end end require_relative 'serialization/tag_serializer' require_relative 'serialization/service_check_serializer' require_relative 'serialization/event_serializer' require_relative 'serialization/field_serializer' require_r...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/connection.rb
Ruby
mit
196
master
1,495
# frozen_string_literal: true module Datadog class Statsd class Connection def initialize(telemetry: nil, logger: nil) @telemetry = telemetry @logger = logger end def reset_telemetry telemetry.reset if telemetry end # not thread safe: `Sender` instances tha...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/connection_cfg.rb
Ruby
mit
196
master
4,080
module Datadog class Statsd class ConnectionCfg attr_reader :host attr_reader :port attr_reader :socket_path attr_reader :transport_type def initialize(host: nil, port: nil, socket_path: nil) initialize_with_constructor_args(host: host, port: port, socket_path: socket_path) ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/serialization/serializer.rb
Ruby
mit
196
master
1,450
# frozen_string_literal: true # require 'forwardable' module Datadog class Statsd module Serialization class Serializer def initialize(prefix: nil, container_id: nil, external_data: nil, global_tags: []) @stat_serializer = StatSerializer.new(prefix, container_id, external_data, global_ta...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/serialization/tag_serializer.rb
Ruby
mit
196
master
2,599
# frozen_string_literal: true module Datadog class Statsd module Serialization class TagSerializer def initialize(global_tags = [], env = ENV) # Convert to hash global_tags = to_tags_hash(global_tags) # Merge with default tags global_tags = default_tags(env)...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/serialization/stat_serializer.rb
Ruby
mit
196
master
2,153
# frozen_string_literal: true module Datadog class Statsd module Serialization class StatSerializer def initialize(prefix, container_id, external_data, global_tags: []) @prefix = prefix @prefix_str = prefix.to_s @tag_serializer = TagSerializer.new(global_tags) ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/serialization/service_check_serializer.rb
Ruby
mit
196
master
1,991
# frozen_string_literal: true module Datadog class Statsd module Serialization class ServiceCheckSerializer SERVICE_CHECK_BASIC_OPTIONS = { timestamp: 'd:', hostname: 'h:', }.freeze def initialize(container_id, external_data, global_tags: []) @tag_ser...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/serialization/field_serializer.rb
Ruby
mit
196
master
990
# frozen_string_literal: true module Datadog class Statsd module Serialization class FieldSerializer VALID_CARDINALITY = [:none, :low, :orchestrator, :high] def initialize(container_id, external_data) @container_id = container_id @external_data = external_data e...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
lib/datadog/statsd/serialization/event_serializer.rb
Ruby
mit
196
master
2,254
# frozen_string_literal: true module Datadog class Statsd module Serialization class EventSerializer EVENT_BASIC_OPTIONS = { date_happened: 'd:', hostname: 'h:', aggregation_key: 'k:', priority: 'p:', source_type_name: 's:', ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/spec_helper.rb
Ruby
mit
196
master
946
require 'datadog/statsd' require 'rspec' require 'rspec/its' require 'byebug' require 'timeout' require 'timecop' require 'stringio' require 'logger' require 'faker' require 'allocation_stats' if RUBY_VERSION >= '2.3.0' require 'climate_control' Dir[File.join(File.dirname(__FILE__), '/support/**/*.rb')].each { |f| re...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd_spec.rb
Ruby
mit
196
master
38,773
require 'spec_helper' describe Datadog::Statsd do let(:socket) { FakeUDPSocket.new(copy_message: true) } subject do described_class.new('localhost', 1234, namespace: namespace, sample_rate: sample_rate, tags: tags, logger: logger, telemetry_flush_interval: -1, origin_detect...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/matchers/make_allocations_matcher.rb
Ruby
mit
196
master
410
require 'rspec/expectations' RSpec::Matchers.define :make_allocations do |expected| supports_block_expectations match do |block| stats = AllocationStats.trace do block.call end @allocations = stats.allocations.to_a.size @allocations <= expected end failure_message do |_| "expected ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/matchers/telemetry_matcher.rb
Ruby
mit
196
master
3,137
require 'rspec/expectations' RSpec::Matchers.define :eq_with_telemetry do |expected_message, telemetry_options| telemetry_options ||= {} # Appends the telemetry metrics to the metrics string passed as 'text' def add_telemetry(text, metrics: 1, events: 0, ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/origin_detection_spec.rb
Ruby
mit
196
master
49,228
require 'spec_helper' require 'fakefs/safe' # To ensure that we can against Ruby v2 we need to use quite an old # version of fakefs that doesn't provide the ino function. # Monkey patch a version here. if RUBY_VERSION < '3.0' class FakeFS::File::Stat def ino 42 end end end describe Datadog::Statsd d...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/message_buffer_spec.rb
Ruby
mit
196
master
3,792
require 'spec_helper' describe Datadog::Statsd::MessageBuffer do subject do described_class.new(connection, max_payload_size: max_payload_size, max_pool_size: max_pool_size, overflowing_stategy: overflowing_stategy, serializer: serializer, ) end let(:connection) do instance_d...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/udp_connection_spec.rb
Ruby
mit
196
master
15,677
require 'spec_helper' describe Datadog::Statsd::UDPConnection do subject do described_class.new(host, port, logger: logger, telemetry: telemetry) end let(:host) do '192.168.1.1' end let(:port) do 4567 end let(:logger) do Logger.new(log).tap do |logger| logger.level = Logger::DEBU...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/single_thread_sender_spec.rb
Ruby
mit
196
master
3,399
require 'spec_helper' describe Datadog::Statsd::SingleThreadSender do subject do described_class.new(message_buffer, flush_interval: flush_interval, queue_size: queue_size) end let(:message_buffer) do instance_double(Datadog::Statsd::MessageBuffer) end let(:flush_interval) { nil } let(:queue_size)...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/timer_spec.rb
Ruby
mit
196
master
2,124
require 'spec_helper' describe Datadog::Statsd::Timer do subject do described_class.new(interval) do sleep callback_durations.next call_times << Time.now end end let(:call_times) { Queue.new } let(:callback_durations) do Enumerator.new do |y| loop do y << 0 end e...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/sender_spec.rb
Ruby
mit
196
master
7,558
require 'spec_helper' describe Datadog::Statsd::Sender do subject do described_class.new( message_buffer, flush_interval: flush_interval, telemetry: telemetry, queue_size: queue_size, queue_class: queue_class, thread_class: thread_class) end let(:queue_size) { 5 } let(:...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/telemetry_spec.rb
Ruby
mit
196
master
11,688
require 'spec_helper' describe Datadog::Statsd::Telemetry do subject do described_class.new(2, container_id, external_data, cardinality, global_tags: global_tags, transport_type: :doe ) end let(:global_tags) do [] end let(:container_id) do nil end let(:external_data) do ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/connection_cfg_spec.rb
Ruby
mit
196
master
9,821
require 'spec_helper' describe Datadog::Statsd::ConnectionCfg do subject do described_class.new(host: host, port: port, socket_path: socket_path) end around do |example| ClimateControl.modify( 'DD_AGENT_HOST' => dd_agent_host, 'DD_DOGSTATSD_URL' => dd_dogstatsd_url, 'DD_DOGSTATSD_PORT'...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/forwarder_spec.rb
Ruby
mit
196
master
13,063
require 'spec_helper' describe Datadog::Statsd::Forwarder do subject do described_class.new(**params) end let(:buffer_max_payload_size) do 1_024 end let(:buffer_max_pool_size) do 50 end let(:buffer_overflowing_stategy) do :anything end let(:buffer_flush_interval) do 15 end ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/uds_connection_spec.rb
Ruby
mit
196
master
12,012
require 'spec_helper' describe Datadog::Statsd::UDSConnection do before do skip "UDS not supported on Windows" if Gem.win_platform? end subject do described_class.new(socket_path, logger: logger, telemetry: telemetry) end let(:socket_path) do '/tmp/socket' end let(:logger) do Logger.ne...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/serialization/service_check_serializer_spec.rb
Ruby
mit
196
master
3,953
require 'spec_helper' describe Datadog::Statsd::Serialization::ServiceCheckSerializer do subject do described_class.new(container_id, external_data, global_tags: global_tags) end let(:external_data) do nil end let(:container_id) do nil end let(:global_tags) do double('global tags') e...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/serialization/tag_serializer_spec.rb
Ruby
mit
196
master
8,195
require 'spec_helper' describe Datadog::Statsd::Serialization::TagSerializer do subject do described_class.new(global_tags) end let(:global_tags) do [] end describe '#format' do context '[testing parameter types]' do [nil, [], {}].each do |empty_value_gt| context "when there is no...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/serialization/event_serializer_spec.rb
Ruby
mit
196
master
7,133
require 'spec_helper' describe Datadog::Statsd::Serialization::EventSerializer do subject do described_class.new(container_id, external_data, global_tags: global_tags) end let(:external_data) do nil end let(:container_id) do nil end let(:global_tags) do double('global tags') end d...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/statsd/serialization/stat_serializer_spec.rb
Ruby
mit
196
master
6,305
require 'spec_helper' describe Datadog::Statsd::Serialization::StatSerializer do subject do described_class.new(prefix, container_id, external_data, global_tags: global_tags) end let(:external_data) do nil end let(:container_id) do nil end let(:prefix) do nil end let(:global_tags)...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/support/fake_udp_socket.rb
Ruby
mit
196
master
520
class FakeUDPSocket def initialize(copy_message: false) @buffer = [] @error_on_send = nil @copy_message = copy_message end def send(message, *_) raise @error_on_send if @error_on_send message = message.dup if @copy_message @buffer.push [message] end def recv @buffer.shift end ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/shared/namespaceable_method.rb
Ruby
mit
196
master
550
RSpec.shared_examples 'a namespaceable method' do |normal_expected_result| context 'without a namespace' do let(:namespace) { nil } it 'sends the non namespaced normal_expected_result' do basic_action expect(socket.recv[0]).to eq_with_telemetry(normal_expected_result) end end context 'w...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/shared/metrics_method.rb
Ruby
mit
196
master
346
RSpec.shared_examples 'a metrics method' do |normal_expected_result, telemetry_options| let(:action_tags) do [] end it_behaves_like 'a namespaceable method', normal_expected_result it_behaves_like 'a log debuggable method', normal_expected_result it_behaves_like 'a taggable method', normal_expected_resul...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/shared/taggable_method.rb
Ruby
mit
196
master
1,319
RSpec.shared_examples 'a taggable method' do |normal_expected_result, telemetry_options| telemetry_options ||= {} context 'when tags are an array of strings' do let(:action_tags) do %w[country:usa state:ny other] end it 'supports tags' do basic_action expect(socket.recv[0]).to eq_wi...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/shared/log_debuggable_method.rb
Ruby
mit
196
master
495
RSpec.shared_examples 'a log debuggable method' do |normal_expected_result| context 'when in DEBUG mode' do before do logger.level = Logger::DEBUG end it 'writes to the log' do basic_action expect(log.string).to match "Statsd: #{normal_expected_result}" end end context 'when i...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/integrations/buffering_spec.rb
Ruby
mit
196
master
6,830
# frozen_string_literal: true require 'spec_helper' RSpec.shared_examples 'Buffering integration testing' do |single_thread| subject do Datadog::Statsd.new('localhost', 1234, telemetry_flush_interval: -1, telemetry_enable: false, single_thread: single_thread, buffer_max_pool_size: buffer...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/integrations/connection_edge_case_spec.rb
Ruby
mit
196
master
13,161
# frozen_string_literal: true require 'spec_helper' describe 'Connection edge cases test' do let(:logger) do Logger.new(log).tap do |logger| logger.level = Logger::INFO end end let(:log) { StringIO.new } describe 'when having problems with UDP communication' do subject do Datadog::Sta...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/integrations/delay_serialization_spec.rb
Ruby
mit
196
master
2,244
require "spec_helper" describe "Delayed serialization mode" do it "defers serialization to message buffer" do buffer = double(Datadog::Statsd::MessageBuffer) # expects an Array is passed and not a String expect(buffer) .to receive(:add) .with(["boo", 1, "c", nil, 1, nil]) # and then expec...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/integrations/telemetry_spec.rb
Ruby
mit
196
master
6,258
# frozen_string_literal: true require 'spec_helper' describe 'Telemetry integration testing' do let(:socket) { FakeUDPSocket.new(copy_message: true) } subject do Datadog::Statsd.new('localhost', 1234, telemetry_flush_interval: -1, origin_detection: false, ) end before do allow(Socket...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/integrations/live_testing_spec.rb
Ruby
mit
196
master
1,074
# frozen_string_literal: true require 'spec_helper' describe 'Live testing' do before do skip('No live testing') unless ENV['LIVE'] end context 'with a real UDP socket' do let(:host) do 'localhost' end let(:port) do 12345 end let(:server_socket) do UDPSocket.new ...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/integrations/allocation_spec.rb
Ruby
mit
196
master
8,577
# frozen_string_literal: true require 'spec_helper' describe 'Allocations and garbage collection' do before do skip 'Ruby too old' if RUBY_VERSION < '2.3.0' end let(:socket) { FakeUDPSocket.new } subject do Datadog::Statsd.new('localhost', 1234, namespace: namespace, sample_rate: sample_...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
spec/integrations/async_sending_spec.rb
Ruby
mit
196
master
3,193
require 'spec_helper' describe 'Sending asynchronously' do subject do Datadog::Statsd::Sender.new(message_buffer).tap(&:start) end let(:message_buffer) do instance_double(Datadog::Statsd::MessageBuffer) end after do subject.stop end context 'with normal sending conditions' do context '...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
examples/random_event_every_xsecnonds_to_localhost.rb
Ruby
mit
196
master
1,628
# Here, we generate random sets of parameters that can be passed when posting an event # Title and text are compulsory but all the other ones are optional # Load the dogstats module. require '../lib/datadog/statsd' # Create a stats instance. statsd = Datadog::Statsd.new('localhost', 8125) # Data to run random tests...
github
DataDog/dogstatsd-ruby
https://github.com/DataDog/dogstatsd-ruby
examples/sidekiq_example.rb
Ruby
mit
196
master
1,841
require 'sidekiq' require '../../lib/datadog/statsd' # How to test these examples: # - Run a redis server on port 6379: # $ docker run --rm --name redis -d -p6379:6379 redis # - Start sidekiq with this file: # $ sidekiq -d -r ./sidekiq_example.rb # - In another shell, perform the jobs using: # $ echo...
github
serpapi/clauneck
https://github.com/serpapi/clauneck
Gemfile
Ruby
mit
196
master
293
source 'https://rubygems.org' gemspec gem 'faraday', '~> 2.7', '>= 2.7.9' gem 'json', '~> 2.6', '>= 2.6.3' gem 'optparse', '~> 0.3.1' gem 'concurrent-ruby', '~> 1.2', '>= 1.2.2' gem 'csv', '~> 3.2', '>= 3.2.7' gem 'zlib', '~> 3.0' gem 'stringio', '~> 3.0', '>= 3.0.7' gem 'brotli', '~> 0.4.0'
github
serpapi/clauneck
https://github.com/serpapi/clauneck
clauneck.gemspec
Ruby
mit
196
master
982
Gem::Specification.new do |s| s.name = 'clauneck' s.version = '0.0.3' s.date = '2023-07-05' s.summary = "Custom Lead Acquisition Using Next-Generation Extraction and Collection Kit" s.description = "A tool for scraping emails, social media accounts, and many more information from websites using Google Search ...
github
serpapi/clauneck
https://github.com/serpapi/clauneck
example.rb
Ruby
mit
196
master
339
#!/usr/bin/env ruby require './lib/clauneck' api_key = "<SerpApi API Key>" # Visit https://serpapi.com/users/sign_up to get free credits. proxy = "proxies.txt" # Only HTTP Proxies are accepted params = { "q": "site:*.ai AND inurl:/contact OR inurl:/contact-us" } Clauneck.run(api_key: api_key, params: params, proxy...
github
serpapi/clauneck
https://github.com/serpapi/clauneck
lib/clauneck.rb
Ruby
mit
196
master
14,842
require 'faraday' require 'json' require 'optparse' require 'concurrent' require 'thread' require 'csv' require 'zlib' require 'stringio' require 'brotli' USER_AGENTS = [ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36", "Mozilla/5.0 (Macintosh...
github
dwbutler/groupify
https://github.com/dwbutler/groupify
Gemfile
Ruby
mit
196
master
622
source 'https://rubygems.org' group :development do gem 'pry' gem "github_changelog_generator" end group :test do gem "rspec", ">= 3" gem "database_cleaner", "~> 1.5.3" gem "combustion", "0.5.5" gem "appraisal" gem 'coveralls', require: false gem "codeclimate-test-reporter", require: nil end # Speci...
github
dwbutler/groupify
https://github.com/dwbutler/groupify
Rakefile
Ruby
mit
196
master
412
#!/usr/bin/env rake require "bundler/setup" require "bundler/gem_tasks" require 'rspec/core/rake_task' desc "Run RSpec" RSpec::Core::RakeTask.new do |t| t.verbose = false end begin require 'github_changelog_generator/task' desc "Regenerate changelog" GitHubChangelogGenerator::RakeTask.new :changelog do |conf...
github
dwbutler/groupify
https://github.com/dwbutler/groupify
groupify.gemspec
Ruby
mit
196
master
880
# -*- encoding: utf-8 -*- require File.expand_path('../lib/groupify/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["dwbutler"] gem.email = ["dwbutler@ucla.edu"] gem.description = %q{Adds group and membership functionality to Rails models} gem.summary = %q{Group functio...
github
dwbutler/groupify
https://github.com/dwbutler/groupify
Appraisals
Ruby
mit
196
master
445
appraise "rails-4.0" do gem 'activerecord', "~> 4.0.0" gem "mongoid", "~> 4.0" end appraise "rails-4.1" do gem 'activerecord', "~> 4.1.0" gem "mongoid", "~> 4.0" end appraise "rails-4.2" do gem 'activerecord', "~> 4.2.0" gem "mongoid", "~> 4.0" end appraise "rails-5.0" do gem 'activerecord', "~> 5.0....
github
dwbutler/groupify
https://github.com/dwbutler/groupify
lib/groupify.rb
Ruby
mit
196
master
393
require 'active_support' module Groupify mattr_accessor :group_membership_class_name, :group_class_name self.group_class_name = 'Group' self.group_membership_class_name = 'GroupMembership' def self.configure yield self end def self.group_membership_klass group_membership_class_n...