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 | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/scalar_function_set_test.rb | Ruby | mit | 249 | main | 4,876 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class ScalarFunctionSetTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@con = @db.connect
end
def teardown
@con&.close
@db&.close
end
def test_initialize_with_string_name
set = DuckD... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/extracted_statements_test.rb | Ruby | mit | 249 | main | 3,095 | # frozen_string_literal: true
require 'test_helper'
require 'time'
module DuckDBTest
class ExtractedStatementsTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@con = @db.connect
end
def teardown
@con.close
@db.close
end
def test_s_new
assert_instance_of... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/prepared_statement_bind_decimal_test.rb | Ruby | mit | 249 | main | 753 | # frozen_string_literal: true
module DuckDBTest
class PreparedStatementDecimalTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@con = @db.connect
@con.query('CREATE TABLE decimals (decimal_value HUGEINT)')
end
def prepare_test_value(value)
@con.query("INSERT INTO decim... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/connection_query_test.rb | Ruby | mit | 249 | main | 359 | # frozen_string_literal: true
module DuckDBTest
class ConnectionQueryTest < Minitest::Test
def teardown
FileUtils.rm_f(@file)
end
def test_prepared_statement_destroy_in_query
outputs = `ruby -Ilib test/ng/connection_query_ng.rb`
@file, before, after = outputs.split("\n")
assert_... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/scalar_function_test.rb | Ruby | mit | 249 | main | 89,910 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class ScalarFunctionTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@con = @db.connect
end
def teardown
@con&.close
@db&.close
end
def test_initialize
sf = DuckDB::ScalarFunction.new... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/logical_type_test.rb | Ruby | mit | 249 | main | 18,059 | # frozen_string_literal: true
require 'test_helper'
require 'securerandom'
module DuckDBTest
class LogicalTypeTest < Minitest::Test
CREATE_TYPE_ENUM_SQL = <<~SQL
CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy', '𝘾𝝾օɭ 😎');
SQL
CREATE_TABLE_SQL = <<~SQL
CREATE TABLE table1(
boolean_... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/enum_test.rb | Ruby | mit | 249 | main | 1,466 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class EnumTest < Minitest::Test
def self.create_table
@db ||= DuckDB::Database.open # FIXME
con = @db.connect
con.query(create_enum_sql)
con.query(create_table_sql)
con.query('INSERT INTO enum_test (id, mood) VAL... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/client_context_test.rb | Ruby | mit | 249 | main | 1,736 | # frozen_string_literal: true
require 'test_helper'
require 'securerandom'
module DuckDBTest
class ClientContextTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@conn = @db.connect
end
def teardown
@conn.disconnect
@db.close
end
# --- connection_id: wraps duc... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/instance_cache_test.rb | Ruby | mit | 249 | main | 2,389 | # frozen_string_literal: true
require 'test_helper'
require 'fileutils'
if defined?(DuckDB::InstanceCache)
module DuckDBTest
class InstanceCacheTest < Minitest::Test
def test_s_new
assert_instance_of DuckDB::InstanceCache, DuckDB::InstanceCache.new
end
def test_get_or_create
... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/result_to_decimal_test.rb | Ruby | mit | 249 | main | 2,108 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class ResultToDecimalTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@con = @db.connect
@con.query('CREATE TABLE decimals (decimal_value DECIMAL(30,8))')
end
def prepare_test_value(value)
@con.quer... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/appender_test.rb | Ruby | mit | 249 | main | 38,509 | # frozen_string_literal: true
require 'test_helper'
require 'time'
module DuckDBTest
class AppenderTest < Minitest::Test
def setup
@db = DuckDB::Database.open # FIXME
@con = @db.connect
end
def safe_drop_table
@con.execute("DROP TABLE #{table};")
rescue DuckDB::Error
# ignor... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/prepared_statement_test.rb | Ruby | mit | 249 | main | 30,840 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class PreparedStatementTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@con = @db.connect
@con.query(self.class.create_table_sql)
@con.query(self.class.insert_sql)
end
def teardown
@con.query... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/result_timestamp_tz_test.rb | Ruby | mit | 249 | main | 1,263 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class ResultTimeStampTzTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@conn = @db.connect
@conn.execute('INSTALL icu;')
@conn.execute('LOAD icu;')
end
def teardown
@conn.execute('DROP TABLE ... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/result_time_tz_test.rb | Ruby | mit | 249 | main | 783 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class ResultTimeTzTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@conn = @db.connect
@conn.execute('INSTALL icu;')
@conn.execute('LOAD icu;')
end
def teardown
@conn.execute('DROP TABLE test;... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/connection_execute_multiple_sql_test.rb | Ruby | mit | 249 | main | 826 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class ConnectionExecuteMultipleSqlTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@con = @db.connect
end
def test_multiple_sql
exception = assert_raises(DuckDB::Error) do
@con.execute('CREATE TAB... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/mysql_test.rb | Ruby | mit | 249 | main | 851 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class MysqlTest < Minitest::Test
def setup
skip 'Set MYSQL_TEST environment variable to run MySQL tests' unless ENV['MYSQL_TEST']
@db = DuckDB::Database.open
@conn = @db.connect
@conn.execute('INSTALL mysql;')
@... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/blob_test.rb | Ruby | mit | 249 | main | 297 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class BlobTest < Minitest::Test
def test_initialize
assert_instance_of(DuckDB::Blob, DuckDB::Blob.new('str'))
end
def test_superclass
assert_equal(String, DuckDB::Blob.superclass)
end
end
end |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/config_test.rb | Ruby | mit | 249 | main | 2,882 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class ConfigTest < Minitest::Test
def test_s_new
config = DuckDB::Config.new
assert_instance_of(DuckDB::Config, config)
end
def test_s_size
assert_operator(0, :<=, DuckDB::Config.size)
end
def test_s_get_c... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/result_union_test.rb | Ruby | mit | 249 | main | 1,238 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class ResultUnionTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@conn = @db.connect
end
def teardown
@conn.execute('DROP TABLE test;')
@conn.close
@db.close
end
def test_result_unio... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/scalar_function/bind_info_test.rb | Ruby | mit | 249 | main | 7,769 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class ScalarFunctionBindInfoTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@conn = @db.connect
end
def teardown
@conn.disconnect
@db.close
end
# set_bind stores a block and returns self (... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/table_function/function_info_test.rb | Ruby | mit | 249 | main | 1,978 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class TableFunctionFunctionInfoTest < Minitest::Test
def setup
@database = DuckDB::Database.open
@connection = @database.connect
end
def teardown
@connection.disconnect
@database.close
end
def test_fu... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/table_function/bind_info_test.rb | Ruby | mit | 249 | main | 4,487 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class TableFunctionBindInfoTest < Minitest::Test
def setup
@db = DuckDB::Database.open
@conn = @db.connect
end
def teardown
@conn.disconnect
@db.close
end
def test_set_bind_callback
table_functi... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/duckdb_test/table_function/init_info_test.rb | Ruby | mit | 249 | main | 1,931 | # frozen_string_literal: true
require 'test_helper'
module DuckDBTest
class TableFunctionInitInfoTest < Minitest::Test
def setup
@database = DuckDB::Database.open
@connection = @database.connect
end
def teardown
@connection.disconnect
@database.close
end
def test_init_c... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | test/ng/connection_query_ng.rb | Ruby | mit | 249 | main | 538 | # frozen_string_literal: true
require 'duckdb'
temp_file = "#{File.expand_path('.', __dir__)}/data.duckdb"
puts temp_file
db = DuckDB::Database.open(temp_file)
con = db.connect
con.query('CREATE TABLE test (id INTEGER)')
con.query('INSERT INTO test VALUES (?), (?)', 1, 2)
con.close
db.close
file_last_saved1 = Fil... |
github | suketa/ruby-duckdb | https://github.com/suketa/ruby-duckdb | ext/duckdb/extconf.rb | Ruby | mit | 249 | main | 1,474 | # frozen_string_literal: true
require 'mkmf'
DUCKDB_REQUIRED_VERSION = '1.4.0'
def check_duckdb_header(header, version)
found = find_header(
header,
'/opt/homebrew/include',
'/opt/homebrew/opt/duckdb/include',
'/opt/local/include'
)
return if found
msg = "#{header} is not found. Install #{he... |
github | dnbert/prm | https://github.com/dnbert/prm | prm.gemspec | Ruby | mit | 249 | master | 783 | Gem::Specification.new do |s|
s.name = 'prm'
s.version = '0.2.14'
s.date = '2015-09-29'
s.summary = "Package Repository Manager"
s.description = %Q(PRM (Package Repository Manager) is an Operating System independent Package Repository tool. It allows you to quickly build Debian and Yum P... |
github | dnbert/prm | https://github.com/dnbert/prm | lib/prm/repo.rb | Ruby | mit | 249 | master | 15,426 | require 'rubygems'
require 'fileutils'
require 'zlib'
require 'digest/md5'
require 'digest/sha1'
require 'digest/sha2'
require 'erb'
require 'find'
require 'thread'
require 'peach'
require 'aws/s3'
require 'arr-pm'
require File.join(File.dirname(__FILE__), 'rpm.rb')
module Debian
def build_apt_repo(path, component... |
github | dnbert/prm | https://github.com/dnbert/prm | lib/prm/rpm.rb | Ruby | mit | 249 | master | 11,371 | #!/usr/bin/env ruby
require 'arr-pm'
require 'fileutils'
require 'peach'
require 'digest'
require 'zlib'
module Redhat
def build_rpm_repo(path,arch,release,gpg,silent)
arch.peach do |a|
release.peach do |r|
full_path = "#{path}/#{r}/#{a}/"
repo_path = "#{full_pa... |
github | vanruby/canada | https://github.com/vanruby/canada | canada.gemspec | Ruby | mit | 249 | master | 940 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'canada/version'
Gem::Specification.new do |spec|
spec.name = "canada"
spec.version = Canada::VERSION
spec.authors = ["Godfrey Chan"]
spec.email = ["godfreykfc... |
github | vanruby/canada | https://github.com/vanruby/canada | Rakefile | Ruby | mit | 249 | master | 227 | require 'rake'
require 'rake/testtask'
require 'bundler/gem_tasks'
task :default => :test
desc 'Run all tests'
Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = FileList['test/**/*_test.rb']
t.verbose = true
end |
github | vanruby/canada | https://github.com/vanruby/canada | lib/canada.rb | Ruby | mit | 249 | master | 1,082 | require "canada/version"
module Canada
module ObjectExtensions
EH_METHOD_REGEXP = /\A(?<method_name>.+)_eh\?\z/
def respond_to_missing?(meth, include_all = false)
if (m = EH_METHOD_REGEXP.match(meth))
super || self.respond_to?("#{m[:method_name]}?", include_all)
else
super
... |
github | vanruby/canada | https://github.com/vanruby/canada | test/canada_test.rb | Ruby | mit | 249 | master | 1,502 | require 'minitest_helper'
require 'canada'
class CanadaTest < MiniTest::Test
def test_eh?
assert [].empty_eh?
refute [1,2,3].empty_eh?
end
def test_respond_to_eh?
yes = [:empty?, :empty_eh?, :respond_to?, :respond_to_eh?]
no = [:not_there, :not_there?, :not_there_eh, :not_there_eh?]
yes.eac... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | Gemfile | Ruby | mit | 249 | main | 391 | # frozen_string_literal: true
source 'https://rubygems.org'
gemspec
group :development do
gem 'debug'
gem 'guard'
gem 'guard-bundler'
gem 'guard-inch'
gem 'guard-rspec', '~> 4.6'
gem 'guard-rubocop'
gem 'inch'
gem 'irb'
gem 'rake', '>= 12.3.3'
gem 'rubocop', '~> 1'
gem 'yard', '~> 0.9.42'
end
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | Rakefile | Ruby | mit | 249 | main | 383 | # frozen_string_literal: true
require 'bundler'
Bundler.setup
Bundler::GemHelper.install_tasks
require 'inch/rake'
Inch::Rake::Suggest.new(:inch)
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)
require 'yard/rake/yardoc_task'
YARD::Rake::Y... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | Guardfile | Ruby | mit | 249 | main | 437 | # frozen_string_literal: true
guard :bundler do
watch('Gemfile')
watch('interactor-contracts.gemspec')
end
guard :inch do
watch(/.+\.rb/)
end
guard :rspec, cmd: 'bundle exec rspec' do
watch('spec/spec_helper.rb') { 'spec' }
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | benchmark-memory.gemspec | Ruby | mit | 249 | main | 855 | # frozen_string_literal: true
require File.expand_path('lib/benchmark/memory/version', __dir__)
Gem::Specification.new do |spec|
spec.name = 'benchmark-memory'
spec.version = Benchmark::Memory::VERSION
spec.authors = ['Michael Herold']
spec.email = ['michael.j.herold@gmail.com']
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/spec_helper.rb | Ruby | mit | 249 | main | 756 | # frozen_string_literal: true
if ENV['COVERAGE'] || ENV['CI']
require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
end
require 'benchmark/memory'
require 'pry'
require 'rspec'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.syntax = :expect
expectat... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory_spec.rb | Ruby | mit | 249 | main | 790 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Benchmark::Memory do
it 'has a version number' do
expect(Benchmark::Memory::VERSION).not_to be nil
end
it 'exposes .memory on Benchmark' do
expect(Benchmark).to respond_to(:memory)
end
describe '.memory' do
around(:each) do |sp... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory/report_spec.rb | Ruby | mit | 249 | main | 831 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Benchmark::Memory::Report do
it 'is initialized with a blank list of entries' do
report = described_class.new
expect(report.entries).to be_empty
end
describe '#add_entry' do
it 'adds an entry to the list of entries' do
report... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory/helpers_spec.rb | Ruby | mit | 249 | main | 742 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Benchmark::Memory::Helpers do
describe '#scale' do
it 'scales values into human terms' do
scale = ->(value) { Benchmark::Memory::Helpers.scale(value) }
expect(scale.call(1)).to eq(' 1.000 ')
expect(sca... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory/job_spec.rb | Ruby | mit | 249 | main | 2,968 | # frozen_string_literal: true
require 'spec_helper'
# rubocop:disable Lint/EmptyBlock
RSpec.describe Benchmark::Memory::Job do
describe '#report' do
it 'raises an ArgumentError when no block is specified' do
job = create_job
expect { job.report('riddle me this') }.to raise_error(ArgumentError)
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory/job/task_spec.rb | Ruby | mit | 249 | main | 555 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Benchmark::Memory::Job::Task do
describe '.new' do
it 'raises an ArgumentError when the action is not a callable' do
expect do
described_class.new('label', nil)
end.to raise_error(ArgumentError)
end
end
describe '#ca... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory/job/io_output_spec.rb | Ruby | mit | 249 | main | 945 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Benchmark::Memory::Job::IOOutput do
describe '#put_entry' do
it 'outputs onto the passed IO' do
entry = create_entry
io = StringIO.new
output = described_class.new(io)
output.put_entry(entry)
expect(io.string).not... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory/job/io_output/comparison_formatter_spec.rb | Ruby | mit | 249 | main | 2,590 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Benchmark::Memory::Job::IOOutput::ComparisonFormatter do
describe '#to_s' do
it 'is blank when the comparison is not possible' do
comp = comparison([])
formatter = described_class.new(comp)
expect(formatter.to_s).to be_empty
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory/measurement/metric_spec.rb | Ruby | mit | 249 | main | 438 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Benchmark::Memory::Measurement::Metric do
describe '#to_s' do
it 'is of consistent length' do
examples = [0, 100, 1_000, 1_000_000, 1_000_000_000, 1_000_000_000_000]
lengths = examples.map do |i|
metric = described_class.new(... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory/held_results/entry_serializer_spec.rb | Ruby | mit | 249 | main | 1,782 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Benchmark::Memory::HeldResults::EntrySerializer do
describe '.load' do
it 'converts JSON documents into entries' do
document =
'{"item":"my super cool test",' \
'"measurement":' \
'{"memory":' \
'{"allocated... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory/report/comparator_spec.rb | Ruby | mit | 249 | main | 1,267 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Benchmark::Memory::Report::Comparator do
describe '.from_spec' do
it 'defaults to memory: :allocated when given nothing' do
subject = described_class.from_spec({})
expect(subject).to eq described_class.new(metric: :memory, value: :a... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | spec/benchmark/memory/report/comparison_spec.rb | Ruby | mit | 249 | main | 1,849 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Benchmark::Memory::Report::Comparison do
describe '#entries' do
it 'is sorted from smallest allocation to largest' do
high_entry = create_high_entry
low_entry = create_low_entry
comparator = Benchmark::Memory::Report::Comparato... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory.rb | Ruby | mit | 249 | main | 713 | # frozen_string_literal: true
require 'benchmark/memory/errors'
require 'benchmark/memory/job'
require 'benchmark/memory/version'
# Performance benchmarking library
module Benchmark
# Benchmark memory usage in code to benchmark different approaches.
# @see https://github.com/michaelherold/benchmark-memory
modul... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/report.rb | Ruby | mit | 249 | main | 1,325 | # frozen_string_literal: true
require 'benchmark/memory/report/comparison'
require 'benchmark/memory/report/entry'
module Benchmark
module Memory
# Hold the results of a set of benchmarks.
class Report
# Instantiate a report to hold entries of tasks and measurements.
#
# @return [Report]
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/measurement.rb | Ruby | mit | 249 | main | 1,639 | # frozen_string_literal: true
require 'forwardable'
require 'benchmark/memory/measurement/metric_extractor'
module Benchmark
module Memory
# Encapsulate the combined metrics of an action.
class Measurement
include Enumerable
extend Forwardable
# Create a Measurement from a MemoryProfiler:... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/held_results.rb | Ruby | mit | 249 | main | 2,694 | # frozen_string_literal: true
require 'forwardable'
require 'benchmark/memory/held_results/entry_serializer'
module Benchmark
module Memory
# Collate results that should be held until the next run.
class HeldResults
extend Forwardable
# Instantiate a new set of held results on a path.
#
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/human_readable_unit.rb | Ruby | mit | 249 | main | 747 | # frozen_string_literal: true
require 'delegate'
module Benchmark
module Memory
# Transforms raw numbers into a human-readable scale and suffix
class HumanReadableUnit < SimpleDelegator
# @return [Integer] the exponential scale of the value
def scale
scale = Math.log10(__getobj__)
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/errors.rb | Ruby | mit | 249 | main | 268 | # frozen_string_literal: true
module Benchmark
module Memory
Error = Class.new(StandardError)
ConfigurationError = Class.new(Error) do
def message
'You did not give a test block to your call to `Benchmark.memory`'
end
end
end
end |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/helpers.rb | Ruby | mit | 249 | main | 913 | # frozen_string_literal: true
require 'benchmark/memory/human_readable_unit'
module Benchmark
module Memory
# Helper methods for formatting output.
module Helpers
# Right-justifies to a length of 20 or adds a line of padding when longer.
#
# @param label [#to_s] The label to justify.
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/job.rb | Ruby | mit | 249 | main | 3,871 | # frozen_string_literal: true
require 'forwardable'
require 'benchmark/memory/job/task'
require 'benchmark/memory/job/io_output'
require 'benchmark/memory/job/null_output'
require 'benchmark/memory/held_results'
require 'benchmark/memory/report'
require 'benchmark/memory/report/comparator'
module Benchmark
module M... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/job/null_output.rb | Ruby | mit | 249 | main | 483 | # frozen_string_literal: true
module Benchmark
module Memory
class Job
# Swallow all output from a job.
class NullOutput
# Swallow entry output.
#
# @return [void]
def put_entry(entry); end
# Swallow comparison output.
#
# @return [void]
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/job/io_output.rb | Ruby | mit | 249 | main | 1,328 | # frozen_string_literal: true
require 'benchmark/memory/job/io_output/comparison_formatter'
require 'benchmark/memory/job/io_output/entry_formatter'
module Benchmark
module Memory
class Job
# Output the results of jobs into an IO.
class IOOutput
# Instantiate a new output that writes to an I... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/job/task.rb | Ruby | mit | 249 | main | 1,373 | # frozen_string_literal: true
require 'memory_profiler'
require 'benchmark/memory/measurement'
module Benchmark
module Memory
class Job
# Hold a labelled job for later measurement.
class Task
# Instantiate a job task for later measurement.
#
# @param label [#to_s] The label f... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/job/io_output/metric_formatter.rb | Ruby | mit | 249 | main | 1,315 | # frozen_string_literal: true
require 'benchmark/memory/helpers'
module Benchmark
module Memory
class Job
class IOOutput
# Format metrics for use with the IOOutput.
class MetricFormatter
include Helpers
# Instantiate a formatter to output a metric into an IO.
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/job/io_output/comparison_formatter.rb | Ruby | mit | 249 | main | 2,103 | # frozen_string_literal: true
require 'benchmark/memory/helpers'
require 'benchmark/memory/job/io_output/metric_formatter'
module Benchmark
module Memory
class Job
class IOOutput
# Format a comparison for use with the IOOutput.
class ComparisonFormatter
include Helpers
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/job/io_output/entry_formatter.rb | Ruby | mit | 249 | main | 1,105 | # frozen_string_literal: true
require 'stringio'
require 'benchmark/memory/helpers'
require 'benchmark/memory/job/io_output/metric_formatter'
module Benchmark
module Memory
class Job
class IOOutput
# Format entries for use with the IOOutput.
class EntryFormatter
include Helpers
... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/held_results/serializer.rb | Ruby | mit | 249 | main | 1,780 | # frozen_string_literal: true
require 'json'
module Benchmark
module Memory
class HeldResults
# Serialize objects for holding between runs.
class Serializer
# Load an object from a JSON document.
#
# @param json [String] A JSON document as a string.
#
# @retur... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/held_results/measurement_serializer.rb | Ruby | mit | 249 | main | 1,149 | # frozen_string_literal: true
require 'benchmark/memory/held_results/serializer'
require 'benchmark/memory/held_results/metric_serializer'
require 'benchmark/memory/measurement'
module Benchmark
module Memory
class HeldResults
# Serialize measurements for holding between runs.
class MeasurementSeria... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/held_results/entry_serializer.rb | Ruby | mit | 249 | main | 955 | # frozen_string_literal: true
require 'benchmark/memory/held_results/serializer'
require 'benchmark/memory/held_results/measurement_serializer'
require 'benchmark/memory/report/entry'
module Benchmark
module Memory
class HeldResults
# Serialize entrys for holding between runs.
class EntrySerializer ... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/held_results/metric_serializer.rb | Ruby | mit | 249 | main | 926 | # frozen_string_literal: true
require 'benchmark/memory/held_results/serializer'
require 'benchmark/memory/measurement/metric'
module Benchmark
module Memory
class HeldResults
# Serialize metrics for holding between runs.
class MetricSerializer < Serializer
# Convert a JSON hash into a Metri... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/report/comparison.rb | Ruby | mit | 249 | main | 1,607 | # frozen_string_literal: true
module Benchmark
module Memory
class Report
# Compare entries against each other.
class Comparison
extend Forwardable
# Instantiate a new comparison.
#
# @param entries [Array<Entry>] The entries to compare.
# @param comparator [C... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/report/entry.rb | Ruby | mit | 249 | main | 961 | # frozen_string_literal: true
require 'forwardable'
module Benchmark
module Memory
class Report
# An entry in a report about a benchmark.
class Entry
# Instantiate a new entry.
#
# @param label [#to_s] The entry label.
# @param measurement [Measurement] The measuremen... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/report/comparator.rb | Ruby | mit | 249 | main | 2,553 | # frozen_string_literal: true
module Benchmark
module Memory
class Report
# Compares two {Entry} for the purposes of sorting and outputting a {Comparison}.
class Comparator
# @private
METRICS = %i[memory objects strings].freeze
# @private
VALUES = %i[allocated retain... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/measurement/metric.rb | Ruby | mit | 249 | main | 978 | # frozen_string_literal: true
require 'benchmark/memory/helpers'
module Benchmark
module Memory
class Measurement
# Describe the ratio of allocated vs. retained memory in a measurement.
class Metric
# Instantiate a Metric of allocated vs. retained memory.
#
# @param type [Sym... |
github | michaelherold/benchmark-memory | https://github.com/michaelherold/benchmark-memory | lib/benchmark/memory/measurement/metric_extractor.rb | Ruby | mit | 249 | main | 1,316 | # frozen_string_literal: true
require 'benchmark/memory/measurement/metric'
module Benchmark
module Memory
# Extracts metrics from a memory profiler result
class MetricExtractor
# Extracts the memory-specific metrics from a profiler result
#
# @param result [MemoryProfiler::Results]
... |
github | savonrb/nori | https://github.com/savonrb/nori | nori.gemspec | Ruby | mit | 249 | main | 865 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "nori/version"
Gem::Specification.new do |s|
s.name = "nori"
s.version = Nori::VERSION
s.authors = ["Daniel Harrington", "John Nunemaker", "Wynn Netherland"]
s.email = "me@rubiii.com"
s.homepage = "https://... |
github | savonrb/nori | https://github.com/savonrb/nori | Rakefile | Ruby | mit | 249 | main | 216 | require "bundler/gem_tasks"
desc "Benchmark Nori parsers"
task :benchmark do
require "benchmark/benchmark"
end
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new
task :default => :spec
task :test => :spec |
github | savonrb/nori | https://github.com/savonrb/nori | spec/nori/string_utils_spec.rb | Ruby | mit | 249 | main | 1,072 | require "spec_helper"
describe Nori::StringUtils do
describe ".snakecase" do
it "lowercases one word CamelCase" do
expect(Nori::StringUtils.snakecase("Merb")).to eq("merb")
end
it "makes one underscore snakecase two word CamelCase" do
expect(Nori::StringUtils.snakecase("MerbCore")).to eq("m... |
github | savonrb/nori | https://github.com/savonrb/nori | spec/nori/nori_spec.rb | Ruby | mit | 249 | main | 23,539 | require "spec_helper"
describe Nori do
Nori::PARSERS.each do |parser, class_name|
context "using the :#{parser} parser" do
let(:parser) { parser }
it "should work with unnormalized characters" do
xml = '<root>&</root>'
expect(parse(xml)).to eq({ 'root' => "&" })
end
... |
github | savonrb/nori | https://github.com/savonrb/nori | spec/nori/api_spec.rb | Ruby | mit | 249 | main | 6,416 | require "spec_helper"
describe Nori do
describe "PARSERS" do
it "should return a Hash of parser details" do
expect(Nori::PARSERS).to eq({ :rexml => "REXML", :nokogiri => "Nokogiri" })
end
end
context ".new" do
it "defaults to not strip any namespace identifiers" do
xml = <<-XML
... |
github | savonrb/nori | https://github.com/savonrb/nori | spec/nori/core_ext/hash_spec.rb | Ruby | mit | 249 | main | 767 | require "spec_helper"
describe Hash do
describe "#normalize_param" do
it "should have specs"
end
describe "#to_xml_attributes" do
it "should turn the hash into xml attributes" do
attrs = { :one => "ONE", "two" => "TWO" }.to_xml_attributes
expect(attrs).to match(/one="ONE"/m)
expect(a... |
github | savonrb/nori | https://github.com/savonrb/nori | lib/nori.rb | Ruby | mit | 249 | main | 2,659 | require "nori/version"
require "nori/core_ext"
require "nori/xml_utility_node"
class Nori
def self.hash_key(name, options = {})
name = name.tr("-", "_") if options[:convert_dashes_to_underscores]
name = name.split(":").last if options[:strip_namespaces]
name = options[:convert_tags_to].call(name) if opt... |
github | savonrb/nori | https://github.com/savonrb/nori | lib/nori/xml_utility_node.rb | Ruby | mit | 249 | main | 8,812 | require "date"
require "time"
require "yaml"
require "bigdecimal"
require "nori/string_with_attributes"
require "nori/string_io_file"
class Nori
# This is a slighly modified version of the XMLUtilityNode from
# http://merb.devjavu.com/projects/merb/ticket/95 (has.sox@gmail.com)
#
# John Nunemaker:
# It's m... |
github | savonrb/nori | https://github.com/savonrb/nori | lib/nori/string_utils.rb | Ruby | mit | 249 | main | 509 | class Nori
module StringUtils
# Converts a string to snake case.
#
# @param inputstring [String] The string to be converted to snake case.
# @return [String] A copy of the input string converted to snake case.
def self.snakecase(inputstring)
str = inputstring.dup
str.gsub!(/::/, '/')
... |
github | savonrb/nori | https://github.com/savonrb/nori | lib/nori/core_ext/hash.rb | Ruby | mit | 249 | main | 1,565 | require "uri"
class Nori
module CoreExt
module Hash
# @param key<Object> The key for the param.
# @param value<Object> The value for the param.
#
# @return <String> This key value pair as a param
#
# @example normalize_param(:name, "Bob Jones") #=> "name=Bob%20Jones"
de... |
github | savonrb/nori | https://github.com/savonrb/nori | lib/nori/parser/nokogiri.rb | Ruby | mit | 249 | main | 1,562 | require "nokogiri"
class Nori
module Parser
# = Nori::Parser::Nokogiri
#
# Nokogiri SAX parser.
module Nokogiri
class Document < ::Nokogiri::XML::SAX::Document
attr_accessor :options
def stack
@stack ||= []
end
def start_element(name, attrs = [])
... |
github | savonrb/nori | https://github.com/savonrb/nori | lib/nori/parser/rexml.rb | Ruby | mit | 249 | main | 1,413 | require "rexml/parsers/baseparser"
require "rexml/text"
require "rexml/document"
class Nori
module Parser
# = Nori::Parser::REXML
#
# REXML pull parser.
module REXML
def self.parse(xml, options)
stack = []
parser = ::REXML::Parsers::BaseParser.new(xml)
while true
... |
github | savonrb/nori | https://github.com/savonrb/nori | benchmark/benchmark.rb | Ruby | mit | 249 | main | 379 | $:.push File.expand_path("../../lib", __FILE__)
require "nori"
require "benchmark"
Benchmark.bm 30 do |x|
num = 500
xml = File.read File.expand_path("../soap_response.xml", __FILE__)
x.report "rexml parser" do
num.times { Nori.new(parser: :rexml).parse xml }
end
x.report "nokogiri parser" do
num.... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | trainer.gemspec | Ruby | mit | 249 | master | 1,096 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'trainer/version'
Gem::Specification.new do |spec|
spec.name = "trainer"
spec.version = Trainer::VERSION
spec.authors = ["Felix Krause"]
spec.email = ["fastla... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | fastlane-plugin-trainer/fastlane-plugin-trainer.gemspec | Ruby | mit | 249 | master | 1,016 | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fastlane/plugin/trainer/version'
Gem::Specification.new do |spec|
spec.name = 'fastlane-plugin-trainer'
spec.version = Fastlane::Trainer::VERSION
spec.author = 'Kraus... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | fastlane-plugin-trainer/Gemfile | Ruby | mit | 249 | master | 210 | source 'https://rubygems.org'
gemspec
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval(File.read(plugins_path), binding) if File.exist?(plugins_path)
gem "trainer", path: ".." |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | fastlane-plugin-trainer/lib/fastlane/plugin/trainer.rb | Ruby | mit | 249 | master | 463 | require 'fastlane/plugin/trainer/version'
module Fastlane
module Trainer
# Return all .rb files inside the "actions" and "helper" directory
def self.all_classes
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
end
end
end
# By default we want to import all available acti... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | fastlane-plugin-trainer/lib/fastlane/plugin/trainer/actions/trainer_action.rb | Ruby | mit | 249 | master | 1,385 | module Fastlane
module Actions
class TrainerAction < Action
def self.run(params)
require "trainer"
params[:path] = Actions.lane_context[Actions::SharedValues::SCAN_GENERATED_PLIST_FILE] if Actions.lane_context[Actions::SharedValues::SCAN_GENERATED_PLIST_FILE]
params[:path] ||= Actio... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | lib/trainer.rb | Ruby | mit | 249 | master | 249 | require 'fastlane'
require 'trainer/version'
require 'trainer/options'
require 'trainer/test_parser'
require 'trainer/junit_generator'
require 'trainer/xcresult'
module Trainer
ROOT = File.expand_path('..', __dir__)
UI = FastlaneCore::UI
end |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | lib/trainer/commands_generator.rb | Ruby | mit | 249 | master | 1,207 | require 'commander'
HighLine.track_eof = false
module Trainer
class CommandsGenerator
include Commander::Methods
def self.start
self.new.run
end
def run
program :version, Trainer::VERSION
program :description, Trainer::DESCRIPTION
program :help, 'Author', 'Felix Krause <tra... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | lib/trainer/xcresult.rb | Ruby | mit | 249 | master | 13,601 | module Trainer
module XCResult
# Model attributes and relationships taken from running the following command:
# xcrun xcresulttool formatDescription
class AbstractObject
attr_accessor :type
def initialize(data)
self.type = data["_type"]["_name"]
end
def fetch_value(data, ... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | lib/trainer/test_parser.rb | Ruby | mit | 249 | master | 10,391 | module Trainer
class TestParser
attr_accessor :data
attr_accessor :file_content
attr_accessor :raw_json
# Returns a hash with the path being the key, and the value
# defining if the tests were successful
def self.auto_convert(config)
FastlaneCore::PrintTable.print_values(config: confi... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | lib/trainer/options.rb | Ruby | mit | 249 | master | 2,879 | module Trainer
class Options
def self.available_options
@options ||= [
FastlaneCore::ConfigItem.new(key: :path,
short_option: "-p",
env_name: "TRAINER_PATH",
default_value: ".",
... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | lib/trainer/junit_generator.rb | Ruby | mit | 249 | master | 932 | module Trainer
class JunitGenerator
attr_accessor :results
def initialize(results)
self.results = results
end
def generate
# JUnit file documentation: http://llg.cubic.org/docs/junit/
# And http://nelsonwells.net/2012/09/how-jenkins-ci-parses-and-displays-junit-output/
# And ... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | spec/test_parser_spec.rb | Ruby | mit | 249 | master | 9,975 | describe Trainer do
describe Trainer::TestParser do
describe "Loading a file" do
it "raises an error if the file doesn't exist" do
expect do
Trainer::TestParser.new("notExistent")
end.to raise_error(/File not found at path/)
end
it "raises an error if FormatVersion is ... |
github | fastlane-community/trainer | https://github.com/fastlane-community/trainer | spec/junit_generator_spec.rb | Ruby | mit | 249 | master | 1,011 | describe Trainer do
describe Trainer::JunitGenerator do
it "works for a valid .plist file" do
tp = Trainer::TestParser.new("spec/fixtures/Valid1.plist")
junit = File.read("spec/fixtures/Valid1.junit")
expect(tp.to_junit).to eq(junit)
end
it "works for a valid .plist file and xcpretty na... |
github | diowa/icare | https://github.com/diowa/icare | Gemfile | Ruby | bsd-2-clause | 249 | main | 1,805 | # frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end
gem 'rails', '7.1.5.2'
gem 'activerecord-postgis-adapter', '~> 9.0'
gem 'airbrake', '~> 13.0'
gem 'auth0... |
github | diowa/icare | https://github.com/diowa/icare | Rakefile | Ruby | bsd-2-clause | 249 | main | 317 | # frozen_string_literal: true
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative 'config/application'
require_relative 'config/configuration'
task test: :spec
Rails.application.load_tasks |
github | diowa/icare | https://github.com/diowa/icare | app/services/conversation_build.rb | Ruby | bsd-2-clause | 249 | main | 560 | # frozen_string_literal: true
class ConversationBuild
def initialize(sender, receiver, conversable, params)
@params = params
@sender = sender
@receiver = receiver
@conversable = conversable
end
def conversation
new_conversation = Conversation.new sender: sender, receiver: receiver, conversab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.