repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
gitviola/ynab-bank-importer | https://github.com/gitviola/ynab-bank-importer/blob/d69e289b8136861c4504f50d68843e9abab5bf1e/lib/transaction_creator.rb | lib/transaction_creator.rb | require 'ynab'
# Calculates the correct parameters for the YNAB transaction
# and build it.
class TransactionCreator
attr_accessor :account_id, :date, :amount, :payee_name, :payee_id,
:category_name, :category_id, :memo,
:import_id, :is_withdrawal
class <<self
require 'ynab/mod... | ruby | MIT | d69e289b8136861c4504f50d68843e9abab5bf1e | 2026-01-04T17:45:50.785060Z | false |
gitviola/ynab-bank-importer | https://github.com/gitviola/ynab-bank-importer/blob/d69e289b8136861c4504f50d68843e9abab5bf1e/lib/dumper/fints.rb | lib/dumper/fints.rb | class Dumper
# Implements logic to fetch transactions via the Fints protocol
# and implements methods that convert the response to meaningful data.
class Fints < Dumper
require 'ruby_fints'
require 'digest/md5'
def initialize(params = {})
@ynab_id = params.fetch('ynab_id')
@username = pa... | ruby | MIT | d69e289b8136861c4504f50d68843e9abab5bf1e | 2026-01-04T17:45:50.785060Z | false |
gitviola/ynab-bank-importer | https://github.com/gitviola/ynab-bank-importer/blob/d69e289b8136861c4504f50d68843e9abab5bf1e/lib/dumper/n26.rb | lib/dumper/n26.rb | class Dumper
# Implements logic to fetch transactions via the N26 api
# and implements methods that convert the response to meaningful data.
class N26 < Dumper
require 'twentysix'
require 'active_support'
require 'digest/md5'
WITHDRAWAL_CATEGORIES = [
'micro-v2-atm',
'micro-v2-cash26'... | ruby | MIT | d69e289b8136861c4504f50d68843e9abab5bf1e | 2026-01-04T17:45:50.785060Z | false |
gitviola/ynab-bank-importer | https://github.com/gitviola/ynab-bank-importer/blob/d69e289b8136861c4504f50d68843e9abab5bf1e/lib/dumper/bbva.rb | lib/dumper/bbva.rb | class Dumper
# Implements logic to fetch transactions via the BBVA Spain api
# and implements methods that convert the response to meaningful data.
class Bbva < Dumper
require 'bankscrap'
require 'bankscrap-bbva'
require 'digest/md5'
def initialize(params = {})
@ynab_id = params.fetch('yna... | ruby | MIT | d69e289b8136861c4504f50d68843e9abab5bf1e | 2026-01-04T17:45:50.785060Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/spec_helper.rb | spec/spec_helper.rb | #############
## WARNING ##
#############
# THIS TEST SUITE IS VERY MEAN TO MYSQL AND ELASTICSEARCH
# IT *WILL* DELETE ANY CONTENT IN THE TEST DBs
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
APP_DIR ||= File.expand_path('../../', __FILE__)
require 'fo... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/support/spec_plan.rb | spec/support/spec_plan.rb | class SpecPlan
def self.config
return {
project_root: File.join(Dir.pwd, 'spec'),
logger: {
stdout: false,
debug: false,
},
}
end
def self.new
return Forklift::Plan.new(self.config)
end
end | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/support/spec_client.rb | spec/support/spec_client.rb | require 'yaml'
require 'erb'
class SpecClient
def self.load_config(file)
YAML.load(ERB.new(File.read(file)).result)
end
def self.mysql(name)
file = File.join(File.dirname(__FILE__), '..', 'config', 'connections', 'mysql', "#{name}.yml")
config = self.load_config(file)
db = config[:database]
... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/support/spec_seeds.rb | spec/support/spec_seeds.rb | require 'json'
require 'fileutils'
class SpecSeeds
def self.setup_mysql
mysql_connections = []
mysql_databases = []
files = Dir["#{File.dirname(__FILE__)}/../config/connections/mysql/*.yml"]
files.each do |f|
name = f.split('/').last.gsub('.yml','')
mysql_connections <... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/integration/mysql_spec.rb | spec/integration/mysql_spec.rb | require 'spec_helper'
describe 'mysql' do
before(:each) do
SpecSeeds.setup_mysql
end
it "can read data (raw)" do
query = 'select * from `users`'
plan = SpecPlan.new
@rows = []
plan.do! {
source = plan.connections[:mysql][:forklift_test_source_a]
source.read(query) {|data|
... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/integration/csv_spec.rb | spec/integration/csv_spec.rb | require 'spec_helper'
require 'csv'
describe 'csv' do
after(:each) do
SpecSeeds.setup_csv
end
it "can read data (simple)" do
plan = SpecPlan.new
@rows = []
plan.do! {
source = plan.connections[:csv][:forklift_test_source]
source.read {|data|
@rows = (@rows + data)
... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/integration/mysql_patterns_spec.rb | spec/integration/mysql_patterns_spec.rb | require 'spec_helper'
describe 'mysql patterns' do
before(:each) do
SpecSeeds.setup_mysql
end
it "can do a raw data pipe" do
plan = SpecPlan.new
plan.do! {
source = plan.connections[:mysql][:forklift_test_source_a]
destination = plan.connections[:mysql][:forklift_test_destination]
... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/integration/elasticsearch_spec.rb | spec/integration/elasticsearch_spec.rb | require 'spec_helper'
describe 'elasticsearch' do
before(:each) do
SpecSeeds.setup_elasticsearch
end
it "can read data (raw)" do
index = 'forklift_test'
query = { query: { match_all: {} } }
plan = SpecPlan.new
@rows = []
plan.do! {
source = plan.connections[:elasticsearch][:forkli... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/integration/basic_spec.rb | spec/integration/basic_spec.rb | require 'spec_helper'
describe 'basics' do
describe 'test suite setup' do
it 'seeded the mysql dbs' do
client = SpecClient.mysql('forklift_test_source_a')
tables = []
client.query("show tables").each do |row|
tables << row.values[0]
end
expect(tables.count).to eql 3
... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/integration/multi_transport_spec.rb | spec/integration/multi_transport_spec.rb | require 'spec_helper'
describe 'multiple trasport types' do
before(:each) do
SpecSeeds.setup_mysql
SpecSeeds.setup_elasticsearch
end
describe 'elasticsearch => mysql' do
it 'can load in a full query' do
table = 'es_import'
index = 'forklift_test'
query = { query: { match_all: {}... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/integration/elasticsearch_patterns_spec.rb | spec/integration/elasticsearch_patterns_spec.rb | require 'spec_helper'
describe 'elasticsearch patterns' do
end | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/integration/transformations_spec.rb | spec/integration/transformations_spec.rb | require 'spec_helper'
describe 'transformations' do
before(:each) do
SpecSeeds.setup_mysql
end
it "can run a native transformation" do
plan = SpecPlan.new
@rows = []
raw = SpecClient.mysql('forklift_test_destination')
plan.do! {
source = plan.connections[:mysql][:forklift_test_... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/unit/misc/step_spec.rb | spec/unit/misc/step_spec.rb | require 'spec_helper'
describe 'misc forklift core' do
describe 'steps' do
before(:each) do
ENV['FORKLIFT_RUN_ALL_STEPS'] = 'false'
end
after(:each) do
ENV['FORKLIFT_RUN_ALL_STEPS'] = 'true'
end
it "will run all steps with no extra ARGV" do
plan = SpecPlan.new
allow(... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/unit/misc/email_spec.rb | spec/unit/misc/email_spec.rb | require 'spec_helper'
require "email_spec"
describe 'misc forklift core' do
describe 'email' do
include EmailSpec::Helpers
include EmailSpec::Matchers
it "can send mail with an email template" do
plan = SpecPlan.new
plan.do! {
email_args = {
to: "YOU@FAKE.com",
... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/unit/misc/pid_spec.rb | spec/unit/misc/pid_spec.rb | require 'spec_helper'
describe 'misc forklift core' do
describe 'pidfile' do
it "can create a pidfile and will remove it when the plan is over" do
plan = SpecPlan.new
pid = "#{File.dirname(__FILE__)}/../../pid/pidfile"
expect(File.exists?(pid)).to eql false
plan.do! {
expect(Fi... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/unit/misc/error_spec.rb | spec/unit/misc/error_spec.rb | require 'spec_helper'
describe 'misc forklift core' do
describe 'error handling' do
it "un-caught errors will raise" do
plan = SpecPlan.new
expect{
plan.do! {
plan.step("step_a"){ raise 'BREAK' }
}
}.to raise_error 'BREAK'
plan.pid.delete!
plan.disconnec... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/unit/connection/mysql_spec.rb | spec/unit/connection/mysql_spec.rb | require 'spec_helper'
require 'zlib'
describe Forklift::Connection::Mysql do
describe "read/write utils" do
before(:each) do
SpecSeeds.setup_mysql
end
it "can read a list of tables" do
plan = SpecPlan.new
plan.do! {
source = plan.connections[:mysql][:forklift_test_source_a]
... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/spec/template/spec_user_transformation.rb | spec/template/spec_user_transformation.rb | class SpecUserTransformation
def do!(connection, forklift, args)
connection.q("ALTER TABLE `users` ADD `full_name` VARCHAR(255) NULL DEFAULT NULL AFTER `updated_at`;")
connection.q("UPDATE `users` SET full_name = CONCAT('#{args[:prefix]}', ' ', first_name, ' ', last_name);")
end
end | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/example/plan.rb | example/plan.rb | # plan = Forklift::Plan.new
# Or, you can pass configs
plan = Forklift::Plan.new ({
# logger: {debug: true}
})
plan.do! {
# do! is a wrapper around common setup methods (pidfile locking, setting up the logger, etc)
# you don't need to use do! if you want finer control
# cleanup from a previous run
plan.step... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/example/transformations/email_suffix.rb | example/transformations/email_suffix.rb | class EmailSuffix
def do!(connection, forklift)
forklift.logger.log "collecting email suffixes..."
suffixes = {}
connection.read("select email from users"){|data|
data.each do |row|
part = row[:email].split('@').last
suffixes[part] = 0 if suffixes[part].nil?
suffixes[part] ... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift.rb | lib/forklift.rb | require 'forklift/version'
module Forklift
lib = File.join(File.expand_path(File.dirname(__FILE__)), 'forklift')
require "#{lib}/base/utils.rb"
require "#{lib}/base/pid.rb"
require "#{lib}/base/logger.rb"
require "#{lib}/base/mailer.rb"
require "#{lib}/base/connection.rb"
Dir["#{lib}/transports/*.rb"]... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/version.rb | lib/forklift/version.rb | module Forklift
VERSION = "2.0.0-alpha"
end
| ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/plan.rb | lib/forklift/plan.rb | require 'active_support/all'
module Forklift
class Plan
def initialize(config={})
@config = default_config.merge(config)
@utils = Forklift::Base::Utils.new
@pid = Forklift::Base::Pid.new(self)
@logger = Forklift::Base::Logger.new(self)
@mailer = Forklif... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/base/mailer.rb | lib/forklift/base/mailer.rb | require 'pony'
require 'erb'
require 'active_support/core_ext/hash/keys'
module Forklift
module Base
class Mailer
def initialize(forklift)
@forklift = forklift
end
# Public: Pull out the settings from config/email.yml.
#
# Returns a Hash with all symbolized keys.
def... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/base/logger.rb | lib/forklift/base/logger.rb | require 'lumberjack'
module Forklift
module Base
class Logger
def initialize(forklift)
@forklift = forklift
end
def forklift
@forklift
end
def messages
@messages ||= []
end
def logger
log_dir = "#{forklift.config[:project_root]}/log"
... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/base/utils.rb | lib/forklift/base/utils.rb | require 'yaml'
require 'erb'
module Forklift
module Base
class Utils
def load_yml(file)
YAML.load(ERB.new(File.read(file)).result)
end
def class_name_from_file(file)
klass = ""
words = file.split("/").last.split(".").first.split("_")
words.each do |word|
... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/base/connection.rb | lib/forklift/base/connection.rb | module Forklift
module Base
class Connection
attr_reader :config, :forklift, :client
def initialize(config, forklift)
@config = config
@forklift = forklift
end
def connect
# Will define @client
raise 'not implemented'
end
def disconnect
... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/base/pid.rb | lib/forklift/base/pid.rb | module Forklift
module Base
class Pid
def initialize(forklift)
@forklift = forklift
end
def forklift
@forklift
end
def pid_dir
"#{forklift.config[:project_root]}/pid"
end
def ensure_pid_dir
`mkdir -p #{pid_dir}`
end
def pid... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/patterns/elasticsearch_patterns.rb | lib/forklift/patterns/elasticsearch_patterns.rb | module Forklift
module Patterns
class Elasticsearch
end
end
end
| ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/patterns/mysql_patterns.rb | lib/forklift/patterns/mysql_patterns.rb | module Forklift
module Patterns
class Mysql
class<<self
# Moves rows from one table to another within a single database.
# This assumes that we can directly insert to the destination from
# the source. If you are moving data between separate MySQL servers
# take a look at {Fo... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/transports/mysql.rb | lib/forklift/transports/mysql.rb | require 'mysql2'
require 'open3'
module Forklift
module Connection
class Mysql < Forklift::Base::Connection
def connect
@client = Mysql2::Client.new(config)
q("USE `#{config[:database]}`")
end
def disconnect
@client.close
end
def default_matcher
:up... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/transports/csv.rb | lib/forklift/transports/csv.rb | require 'csv'
require 'fileutils'
module Forklift
module Connection
class Csv < Forklift::Base::Connection
def connect; end
def disconnect; end
def read(size=forklift.config[:batch_size])
data = []
CSV.foreach(config[:file], headers: true, converters: :all) do |row|
d... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/lib/forklift/transports/elasticsearch.rb | lib/forklift/transports/elasticsearch.rb | require 'elasticsearch'
module Forklift
module Connection
class Elasticsearch < Forklift::Base::Connection
def connect
@client = ::Elasticsearch::Client.new(config)
end
def disconnect
@client = nil
end
def read(index, query, looping=true, from=0, size=forklift.conf... | ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
taskrabbit/forklift | https://github.com/taskrabbit/forklift/blob/e4261da656cb0af77cea37deb07502e24bb1abe2/template/plan.rb | template/plan.rb | # plan = Forklift::Plan.new
# Or, you can pass configs
plan = Forklift::Plan.new({
# logger: {debug: true}
})
plan.do! do
# Your plan here.
end
| ruby | Apache-2.0 | e4261da656cb0af77cea37deb07502e24bb1abe2 | 2026-01-04T17:45:51.809866Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/app/controllers/healthcheck/healthchecks_controller.rb | app/controllers/healthcheck/healthchecks_controller.rb | # frozen_string_literal: true
require 'action_controller/railtie'
module Healthcheck
class HealthchecksController < ActionController::Base
def check
return Healthcheck.custom!(self) if Healthcheck.custom?
checker = Healthcheck.check
response = if checker.errored?
Healthchec... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/healthcheck_spec.rb | spec/healthcheck_spec.rb | # frozen_string_literal: true
RSpec.describe Healthcheck, type: :module do
it { expect(described_class::VERSION).not_to be nil }
describe '.configure' do
let(:name) { :zero_division }
let(:block) { -> { 100 / 0 } }
subject do
described_class.configure do |config|
config.success = 200
... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'bundler/setup'
require 'support/configs/simple_cov_config'
SimpleCovConfig.configure
require 'healthcheck'
require './app/controllers/healthcheck/healthchecks_controller'
require File.expand_path('../spec/dummy/config/environment.rb', __dir__)
ENV['RAILS_ROOT'] ||= File.dirname... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/support/configs/simple_cov_config.rb | spec/support/configs/simple_cov_config.rb | # frozen_string_literal: true
require 'simplecov'
require 'simplecov-console'
module SimpleCovConfig
def self.configure
SimpleCov.formatter = SimpleCov::Formatter::Console
SimpleCov.minimum_coverage 100
SimpleCov.start do
add_filter { |source_file| cover?(source_file.lines) }
end
end
def ... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/app/controllers/healthcheck/healthchecks_controller_spec.rb | spec/app/controllers/healthcheck/healthchecks_controller_spec.rb | # frozen_string_literal: true
RSpec.describe Healthcheck::HealthchecksController, type: :model do
describe '#check' do
let(:controller) { described_class.new }
let(:verbose) { false }
subject { controller.check }
before do
Healthcheck.configure do |config|
config.success = 200
... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/requests/healthcheck_spec.rb | spec/requests/healthcheck_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Healthcheck', type: :request do
describe '/healthcheck' do
subject { get '/healthcheck' }
before do
Healthcheck.configuration.add_check :year_check, -> { raise StandardError, 'year' if Time.current.year == 1969 }
Healthcheck.co... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/app/jobs/application_job.rb | spec/dummy/app/jobs/application_job.rb | # frozen_string_literal: true
class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/app/controllers/application_controller.rb | spec/dummy/app/controllers/application_controller.rb | # frozen_string_literal: true
class ApplicationController < ActionController::API
end
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/application.rb | spec/dummy/config/application.rb | # frozen_string_literal: true
require_relative 'boot'
require 'rails'
# Pick the frameworks you want:
# require 'active_model/railtie'
# require 'active_job/railtie'
# require "active_record/railtie"
# require "active_storage/engine"
require 'action_controller/railtie'
# require "action_mailer/railtie"
# require "act... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/environment.rb | spec/dummy/config/environment.rb | # frozen_string_literal: true
# Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/puma.rb | spec/dummy/config/puma.rb | # frozen_string_literal: true
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for mini... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/routes.rb | spec/dummy/config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
Healthcheck.routes(self)
end
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/spring.rb | spec/dummy/config/spring.rb | # frozen_string_literal: true
Spring.watch(
'.ruby-version',
'.rbenv-vars',
'tmp/restart.txt',
'tmp/caching-dev.txt'
)
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/boot.rb | spec/dummy/config/boot.rb | # frozen_string_literal: true
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/initializers/filter_parameter_logging.rb | spec/dummy/config/initializers/filter_parameter_logging.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/initializers/application_controller_renderer.rb | spec/dummy/config/initializers/application_controller_renderer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/initializers/healthcheck.rb | spec/dummy/config/initializers/healthcheck.rb | # frozen_string_literal: true
Healthcheck.configure do |config|
config.success = 200
config.error = 503
config.verbose = false
config.route = '/healthcheck'
config.method = :get
end
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/initializers/wrap_parameters.rb | spec/dummy/config/initializers/wrap_parameters.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_con... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/initializers/inflections.rb | spec/dummy/config/initializers/inflections.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflect... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/initializers/backtrace_silencers.rb | spec/dummy/config/initializers/backtrace_silencers.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if ... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/initializers/mime_types.rb | spec/dummy/config/initializers/mime_types.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/initializers/cors.rb | spec/dummy/config/initializers/cors.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
# Read more: https://github.com/cyu/rack-cors
# Rails.application.config... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/environments/test.rb | spec/dummy/config/environments/test.rb | # frozen_string_literal: true
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.applic... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/environments/development.rb | spec/dummy/config/environments/development.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/dummy/config/environments/production.rb | spec/dummy/config/environments/production.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, a... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/healthcheck/check_spec.rb | spec/healthcheck/check_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Healthcheck::Check, type: :model do
let(:name) { :zero_division }
let(:block) { -> { 100 / 0 } }
subject { described_class.new(name, block) }
it { is_expected.to be_a(described_class) }
it { expect(subject.name).to eq(name) }
it { expect... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/healthcheck/router_spec.rb | spec/healthcheck/router_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Healthcheck::Router, type: :model do
describe '#mount' do
let(:router) { double('Router') }
subject { described_class.mount(router) }
before do
Healthcheck.configure do |config|
config.method = :get
config.route =... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/healthcheck/configuration_spec.rb | spec/healthcheck/configuration_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Healthcheck::Configuration, type: :model do
describe '#initialize' do
subject { described_class.new }
it { is_expected.to be_a(described_class) }
it { expect(subject.success).to be_nil }
it { expect(subject.error).to be_nil }
it... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/healthcheck/error_spec.rb | spec/healthcheck/error_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Healthcheck::Error, type: :model do
describe '#initialize' do
let(:name) { :migrations }
let(:exception) { StandardError }
let(:message) { 'Migrations are pending. To resolve this issue, run: bin/rails db:migrate RAILS_ENV=production' }
... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/spec/healthcheck/checker_spec.rb | spec/healthcheck/checker_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Healthcheck::Checker, type: :model do
describe '#initialize' do
it { is_expected.to be_a(described_class) }
it { expect(subject.errors).to be_empty }
end
describe '#check' do
let(:checker) { described_class.new }
subject { check... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck.rb | lib/healthcheck.rb | # frozen_string_literal: true
require 'healthcheck/version'
require 'healthcheck/configuration'
require 'healthcheck/check'
require 'healthcheck/checker'
require 'healthcheck/error'
require 'healthcheck/router'
require 'healthcheck/engine'
require 'healthcheck/response/base'
require 'healthcheck/response/success'
req... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/rails-healthcheck.rb | lib/rails-healthcheck.rb | # frozen_string_literal: true
require 'healthcheck'
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/generators/healthcheck/install_generator.rb | lib/generators/healthcheck/install_generator.rb | # frozen_string_literal: true
require 'rails/generators/base'
module Healthcheck
class InstallGenerator < Rails::Generators::Base
desc 'It creates an initializer to set the healthcheck settings'
def create_initializer_file
create_file(
'config/initializers/healthcheck.rb',
<<~HEALTHCHE... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck/version.rb | lib/healthcheck/version.rb | # frozen_string_literal: true
module Healthcheck
VERSION = '1.4.0'
end
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck/router.rb | lib/healthcheck/router.rb | # frozen_string_literal: true
module Healthcheck
class Router
def self.mount(router)
router.send(
Healthcheck.configuration.method,
Healthcheck.configuration.route => 'healthcheck/healthchecks#check'
)
end
end
end
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck/configuration.rb | lib/healthcheck/configuration.rb | # frozen_string_literal: true
module Healthcheck
class Configuration
SETTINGS = %i[success error verbose route method checks custom].freeze
attr_accessor(*SETTINGS)
def initialize
clear!
end
def add_check(name, block)
@checks << Check.new(name, block)
end
def clear!
... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck/check.rb | lib/healthcheck/check.rb | # frozen_string_literal: true
module Healthcheck
class Check
attr_accessor :name, :block
def initialize(name, block)
@name = name
@block = block
end
def execute!
block.call
end
end
end
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck/engine.rb | lib/healthcheck/engine.rb | # frozen_string_literal: true
require 'rails'
module Healthcheck
class Engine < Rails::Engine
end
end
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck/error.rb | lib/healthcheck/error.rb | # frozen_string_literal: true
module Healthcheck
class Error
attr_accessor :name, :exception, :message
def initialize(name, exception, message)
@name = name
@exception = exception.to_s
@message = message&.squish
end
end
end
| ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck/checker.rb | lib/healthcheck/checker.rb | # frozen_string_literal: true
module Healthcheck
class Checker
attr_accessor :errors
def initialize
@errors = []
end
def check
Healthcheck.configuration
.checks
.map { |c| Thread.new { execute(c) } }
.each(&:join)
end
def error... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck/response/success.rb | lib/healthcheck/response/success.rb | # frozen_string_literal: true
module Healthcheck
module Response
class Success < Base
def verbose
{
status: @configuration.success,
json: {
code: @configuration.success,
status: @configuration.checks.each_with_object({}) { |check, obj| obj[check.name] = '... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck/response/base.rb | lib/healthcheck/response/base.rb | # frozen_string_literal: true
module Healthcheck
module Response
class Base
def initialize(controller, checker)
@controller = controller
@checker = checker
@configuration = Healthcheck.configuration
end
def execute!
verbose? ? @controller.render(verbose) : @cont... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
linqueta/rails-healthcheck | https://github.com/linqueta/rails-healthcheck/blob/8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238/lib/healthcheck/response/error.rb | lib/healthcheck/response/error.rb | # frozen_string_literal: true
module Healthcheck
module Response
class Error < Base
def verbose
{
status: Healthcheck.configuration.error,
json: {
code: Healthcheck.configuration.error,
errors: @checker.errors.as_json
}
}
end
... | ruby | MIT | 8afb0f08ae2a7f3ace2432a1fc9d76e4478a1238 | 2026-01-04T17:45:59.256167Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/spec_helper.rb | spec/spec_helper.rb | require "bundler/setup"
require 'byebug'
require 'ruby-statistics'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/bigdecimal_spec.rb | spec/ruby-statistics/bigdecimal_spec.rb | require 'spec_helper'
require 'bigdecimal'
require 'bigdecimal/util'
describe BigDecimal do
context 'when bigdecimal is passed to personalized math functions' do
it 'truncates the decimal numbers and calculates the factorial for the real part' do
expect(Math.factorial(BigDecimal(5.45354598234834, 16))).to ... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/math_spec.rb | spec/ruby-statistics/math_spec.rb | require 'spec_helper'
describe Math do
describe '.factorial' do
it 'is not defined for numbers less than zero' do
expect(described_class.factorial(rand(-100...0))).to be_nil
end
it 'returns one for zero or one' do
expect(described_class.factorial(0)).to eq 1
expect(described_class.fact... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/enumerable_spec.rb | spec/ruby-statistics/enumerable_spec.rb | require 'spec_helper'
describe Enumerable do
describe '#mean' do
it 'calculates the mean of an specific collection' do
expect((1..5).to_a.mean).to eq 3.0
expect((1..10).to_a.mean).to eq 5.5
expect((-10..-5).to_a.mean).to eq -7.5
end
end
describe '#variance' do
it 'calculates the *s... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/spearman_rank_coefficient_spec.rb | spec/ruby-statistics/spearman_rank_coefficient_spec.rb | require 'spec_helper'
describe RubyStatistics::SpearmanRankCoefficient do
describe '.rank' do
context 'when only ranks are needed' do
it 'returns an array of elements corresponding to the expected ranks wihout altering order' do
expected_ranks = [4, 1, 3, 2, 5]
result = described_class.ran... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/statistical_test/t_test_spec.rb | spec/ruby-statistics/statistical_test/t_test_spec.rb | require 'spec_helper'
describe RubyStatistics::StatisticalTest::TTest do
describe '.perform' do
context 'when there is an standard deviation of zero' do
let(:alpha) { 0.05 }
it 'does not perform a t-test when standard deviation of zero' do
sample_1 = [1.0, 1.0, 1.0]
mean = 1.0
... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/statistical_test/chi_squared_test_spec.rb | spec/ruby-statistics/statistical_test/chi_squared_test_spec.rb | require 'spec_helper'
describe RubyStatistics::StatisticalTest::ChiSquaredTest do
describe '.chi_statistic' do
# example ONE
# explained here: https://www.thoughtco.com/chi-square-goodness-of-fit-test-example-3126382
it 'returns an array with expected chi-squared statistic value following example ONE' do... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/statistical_test/kolmogorov_smirnov_test_spec.rb | spec/ruby-statistics/statistical_test/kolmogorov_smirnov_test_spec.rb | require 'spec_helper'
describe RubyStatistics::StatisticalTest::KolmogorovSmirnovTest do
describe 'KSTest' do
it 'defines KSTest as an alias for the KolmogorovSmirnovTest class name' do
expect(RubyStatistics::StatisticalTest::KSTest).to be_a(Class)
expect(RubyStatistics::StatisticalTest::KSTest).to e... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/statistical_test/wilcoxon_rank_sum_test_spec.rb | spec/ruby-statistics/statistical_test/wilcoxon_rank_sum_test_spec.rb | require 'spec_helper'
describe RubyStatistics::StatisticalTest::WilcoxonRankSumTest do
let(:test_class) { described_class.new }
it 'can be instantiated using the MannWhitneyU alias' do
expect(described_class).to eq RubyStatistics::StatisticalTest::MannWhitneyU
end
describe '#rank' do
it 'ranks an spe... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/statistical_test/f_test_spec.rb | spec/ruby-statistics/statistical_test/f_test_spec.rb | require 'spec_helper'
describe RubyStatistics::StatisticalTest::FTest do
describe '.anova_f_score' do
context 'when only two groups have been specified' do
let(:group_one) { (1..15).to_a.sample(5) }
let(:group_two) { (1..15).to_a.sample(5) }
let(:variances) { [group_one.variance, group_two.vari... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/distribution/binomial_spec.rb | spec/ruby-statistics/distribution/binomial_spec.rb | require 'spec_helper'
describe RubyStatistics::Distribution::Binomial do
describe '#probability_mass_function' do
it 'is not defined for negative values' do
expect(described_class.new(0, 0).probability_mass_function(rand(-10...0))).to be_nil
end
it 'is not defined for values greater than the numbe... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/distribution/beta_spec.rb | spec/ruby-statistics/distribution/beta_spec.rb | require 'spec_helper'
describe RubyStatistics::Distribution::Beta do
describe '#cumulative_function' do
it 'returns one for values greater than one' do
expect(described_class.new(rand(10), rand(10)).cumulative_function(rand(2..10))).to eq 1
end
it 'is not defined for values less than zero' do
... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/distribution/logseries_spec.rb | spec/ruby-statistics/distribution/logseries_spec.rb | require 'spec_helper'
describe RubyStatistics::Distribution::LogSeries do
describe '.density_function' do
it 'is not defined for negative events' do
expect(described_class.density_function(rand(-5..-1), rand)).to be_nil
end
it 'is not defined for zero events' do
expect(described_class.densit... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/distribution/uniform_spec.rb | spec/ruby-statistics/distribution/uniform_spec.rb | require 'spec_helper'
describe RubyStatistics::Distribution::Uniform do
describe '#density_function' do
it 'returns the expected value for the uniform distribution' do
left, right = 3.0, 4.0
expected = 1/(right - left)
expect(described_class.new(left, right).density_function(rand(3.0..4.0))).t... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/distribution/f_spec.rb | spec/ruby-statistics/distribution/f_spec.rb | require 'spec_helper'
describe RubyStatistics::Distribution::F do
describe '#cumulative_function' do
it 'returns the expected probabilities for the F distribution' do
results = [0.5210509, 0.7436128, 0.8418970, 0.8930887, 0.9229813]
f_distribution = described_class.new(3, 4) # d1: 3, d2: 4
(1.... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/distribution/poisson_spec.rb | spec/ruby-statistics/distribution/poisson_spec.rb | require 'spec_helper'
describe RubyStatistics::Distribution::Poisson do
describe '#probability_mass_function' do
it 'returns the expected values using the poisson distribution' do
results = [0.271, 0.271, 0.180, 0.090, 0.036]
poisson = described_class.new(2) # lambda: 2
(1..5).each_with_index ... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/distribution/geometric_spec.rb | spec/ruby-statistics/distribution/geometric_spec.rb | require 'spec_helper'
describe RubyStatistics::Distribution::Geometric do
describe '#initialize' do
it 'creates a distribution that does not allow probabilities of 100 % chance by default' do
expect(described_class.new(rand).always_success_allowed).to be false
end
it 'creates a distribution that a... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/distribution/gamma_spec.rb | spec/ruby-statistics/distribution/gamma_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe RubyStatistics::Distribution::Gamma do
let(:shape_p) { 4 }
let(:scale_p) { 2 }
let(:rate_p) { 1.0 / shape_p }
let(:rate_gamma) { described_class.new(shape: shape_p) }
let(:scale_gamma) { described_class.new(shape: shape_p, scale: scale_p) }
bef... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
estebanz01/ruby-statistics | https://github.com/estebanz01/ruby-statistics/blob/0ac388ab734120bd708164a10261b25b53faf29d/spec/ruby-statistics/distribution/weibull_spec.rb | spec/ruby-statistics/distribution/weibull_spec.rb | require 'spec_helper'
describe RubyStatistics::Distribution::Weibull do
describe '#density_function' do
it 'returns the expected density for the weibull distribution' do
results = [0.04614827, 0.16546817, 0.27667238, 0.27590958, 0.16620722]
(1..5).each_with_index do |number, index|
weibull =... | ruby | MIT | 0ac388ab734120bd708164a10261b25b53faf29d | 2026-01-04T17:46:01.529291Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.