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 |
|---|---|---|---|---|---|---|---|---|
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/test/models/analyzer_test.rb | test/models/analyzer_test.rb | # frozen_string_literal: true
require "test_helper"
class AnalyzerTest < ActiveSupport::TestCase
test "classes" do
analyzer = Analyzer.new
analyzer.analyze_code("test.rb", <<~RUBY)
# comment1
# comment2
class Foo
end
RUBY
assert_equal 1, analyzer.classes.length
clazz =... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/test/models/rbs/nilable_test.rb | test/models/rbs/nilable_test.rb | # frozen_string_literal: true
require "test_helper"
module RBS
class NilableTest < ActiveSupport::TestCase
def setup
@gem = GemSpec.find("activerecord", "7.0.7")
@module = @gem.find_class("ActiveRecord::ConnectionAdapters::PoolManager")
@method = @module.find_method("pool_configs")
end
... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/test/models/rbs/rbs_test.rb | test/models/rbs/rbs_test.rb | # frozen_string_literal: true
require "test_helper"
module RBS
class RBSTest < ActiveSupport::TestCase
def setup
@gem = GemSpec.find("railties", "7.0.6")
@module = @gem.find_module("Rails")
@method = @module.find_method("env")
end
test "with no samples" do
assert_nil @method.rbs... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/test/models/rbs/constructor_test.rb | test/models/rbs/constructor_test.rb | # frozen_string_literal: true
require "test_helper"
module RBS
class ConstructorTest < ActiveSupport::TestCase
def setup
@gem = GemSpec.find("nokogiri", "1.15.0")
@class = @gem.find_class("Nokogiri::XML::Document")
@method = @class.find_method("initialize")
end
test "initialize's retu... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/test/models/rbs/parameters_test.rb | test/models/rbs/parameters_test.rb | # frozen_string_literal: true
require "test_helper"
module RBS
class ParametersTest < ActiveSupport::TestCase
def setup
@gem = GemSpec.find("nokogiri", "1.15.0")
@class = @gem.find_class("Nokogiri::XML::Document")
@method = @class.find_method("parse")
end
test "positional arguments an... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/test/channels/application_cable/connection_test.rb | test/channels/application_cable/connection_test.rb | # frozen_string_literal: true
require "test_helper"
module ApplicationCable
class ConnectionTest < ActionCable::Connection::TestCase
# test "connects with cookies" do
# cookies.signed[:user_id] = 42
#
# connect
#
# assert_equal connection.user_id, "42"
# end
end
end
| ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/application.rb | config/application.rb | # frozen_string_literal: true
require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Gemsh
class Application < Rails::Application
# Initialize configuration defaults for... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/environment.rb | config/environment.rb | # frozen_string_literal: true
# Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/puma.rb | config/puma.rb | # frozen_string_literal: true
# This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
# Puma can serve each request in a thread from an int... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/routes.rb | config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
root "page#home"
get "/home" => "page#home", as: :home
get "/docs" => "page#docs", as: :docs
get "/community" => "page#community", as: :community
get "/types" => "page#types", as: :types
resources :search, only: :index
draw :gems
draw :a... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/sitemap.rb | config/sitemap.rb | # frozen_string_literal: true
# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = "https://gem.sh"
SitemapGenerator::Sitemap.create do
# Put links creation logic here.
#
# The root path "/" and sitemap index file are added automatically for you.
# Links are added to the Sitemap in th... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/boot.rb | 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.
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
| ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/initializers/heroicon.rb | config/initializers/heroicon.rb | # frozen_string_literal: true
Heroicon.configure do |config|
config.variant = :solid # Options are :solid, :outline and :mini
##
# You can set a default class, which will get applied to every icon with
# the given variant. To do so, un-comment the line below.
# config.default_class = {solid: "h-5 w-5", outl... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/initializers/content_security_policy.rb | config/initializers/content_security_policy.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for ... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/initializers/rorvswild.rb | config/initializers/rorvswild.rb | # frozen_string_literal: true
return unless Rails.env.production?
if (api_key = Rails.application.credentials.dig(:rorvswild, :api_key))
RorVsWild.start(
api_key: api_key,
ignored_exceptions: [
"ActionController::RoutingError",
"ZeroDivisionError",
],
)
end
| ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/initializers/type_fusion.rb | config/initializers/type_fusion.rb | # frozen_string_literal: true
# require "type_fusion"
#
# TypeFusion.config do |config|
# config.type_sample_call_rate = 0.001
# config.endpoint = "http://localhost:3000/api/v1/types/samples"
# end
| ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/initializers/inflections.rb | 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::Inflec... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/initializers/permissions_policy.rb | config/initializers/permissions_policy.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide HTTP permissions policy. For further
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
# Rails.application.config.permissions_policy do |policy|
# policy.camera ... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/initializers/assets.rb | config/initializers/assets.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.image... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/initializers/meta_tags.rb | config/initializers/meta_tags.rb | # frozen_string_literal: true
MetaTags.config do |config|
# Default title methods to be checked for title
#
# config.title_methods = %w(title name)
# Default decsription methods to be checked for description
#
# config.description_methods = %w(description desc)
# Default image methods to be checked for... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/initializers/reactionview.rb | config/initializers/reactionview.rb | # frozen_string_literal: true
ReActionView.configure do |config|
# Intercept .html.erb templates and process them with `Herb::Engine` for enhanced features
config.intercept_erb = Rails.env.development?
# Enable debug mode in development (adds debug attributes to HTML)
config.debug_mode = Rails.env.development... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/routes/gems.rb | config/routes/gems.rb | # frozen_string_literal: true
scope "/", as: :gem do
resources :gems, only: [], param: :gem, as: :gem, module: :gems do
member do
scope "/v:version", as: :version, version: %r{[^/]*} do
draw :gem
get "/" => "/gems#show"
end
draw :gem
end
end
end
get "/gems" => "gems#inde... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/routes/methods.rb | config/routes/methods.rb | # frozen_string_literal: true
resources :instance_methods, only: :show
resources :class_methods, only: :show
# TODO: remove redirects
get "/instance_method/:id", to: redirect { |_params, request|
request.url.gsub("/instance_method/", "/instance_methods/")
}
get "/class_method/:id", to: redirect { |_params, request... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/routes/api.rb | config/routes/api.rb | # frozen_string_literal: true
namespace :api do
namespace :v1 do
namespace :types do
resources :samples, only: :create
end
end
end
| ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/routes/gem.rb | config/routes/gem.rb | # frozen_string_literal: true
resources :classes, only: [:index, :show] do
draw :methods
end
resources :modules, only: [:index, :show] do
draw :methods
end
draw :methods
resources :guides, only: [:index, :show]
resources :search, only: [:index]
resources :docs, only: [:index, :show]
resources :files, only: [:in... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/environments/test.rb | config/environments/test.rb | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
# 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 r... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/environments/development.rb | config/environments/development.rb | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
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 any time
# it changes. This slows down response ti... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
marcoroth/gem.sh | https://github.com/marcoroth/gem.sh/blob/8a4a44bdd857ea79114017608d73c5cd03c21dba/config/environments/production.rb | config/environments/production.rb | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot. This eager loads... | ruby | MIT | 8a4a44bdd857ea79114017608d73c5cd03c21dba | 2026-01-04T17:48:24.521520Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/init.rb | init.rb | require 'related'
| ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/test/model_test.rb | test/model_test.rb | require File.expand_path('test/test_helper')
class ModelTest < ActiveModel::TestCase
class Event < Related::Node
property :attending_count, Integer
property :popularity, Float
property :start_date, DateTime
property :end_date, DateTime
property :location do |value|
"http://maps.google.com/... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/test/test_helper.rb | test/test_helper.rb |
dir = File.dirname(File.expand_path(__FILE__))
$LOAD_PATH.unshift dir + '/../lib'
require 'rubygems'
require 'bundler/setup'
require 'test/unit'
require 'related'
require 'redis/distributed'
#
# make sure we can run redis
#
if !system("which redis-server")
puts '', "** can't find `redis-server` in your path"
pu... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/test/custom_id_attribute_test.rb | test/custom_id_attribute_test.rb | require File.expand_path('test/test_helper')
class CustomIdAttribute < ActiveModel::TestCase
class FakeThing < Related::Node
property :id, Integer
property :name, String
end
def setup
Related.flushall
end
def test_manually_set_id
FakeThing.create(id: 42, name: "Bond, James Bond")
foun... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/test/follower_test.rb | test/follower_test.rb | require File.expand_path('test/test_helper')
require 'related/follower'
class User < Related::Node
include Related::Follower
end
class FollowerTest < MiniTest::Unit::TestCase
def setup
Related.flushall
@user1 = User.create
@user2 = User.create
end
def test_can_follow
@user1.follow!(@user2)
... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/test/data_flow_test.rb | test/data_flow_test.rb | require File.expand_path('test/test_helper')
class ModelTest < ActiveModel::TestCase
class StepOne
def self.perform(data)
yield({ :text => data['text'] })
end
end
class StepTwo
def self.perform(data)
yield({ :id => 'StepTwo', :text => data['text'].downcase })
end
end
class Step... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/test/related_test.rb | test/related_test.rb | require File.expand_path('test/test_helper')
class RelatedTest < MiniTest::Unit::TestCase
def setup
Related.flushall
end
def test_can_set_a_namespace_through_a_url_like_string
assert Related.redis
assert_equal :related, Related.redis.namespace
old_redis = Related.redis
Related.redis = 'loca... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/test/custom_node_test.rb | test/custom_node_test.rb | require File.expand_path('test/test_helper')
require 'pp'
class CustomNodeTest < ActiveModel::TestCase
class CustomNode
include Related::Node::QueryMethods
attr_accessor :id
def self.flush
@database = {}
end
def self.create
n = self.new
n.id = Related.generate_id
@databas... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/test/active_model_test.rb | test/active_model_test.rb | require File.expand_path('test/test_helper')
class ActiveModelTest < ActiveModel::TestCase
include ActiveModel::Lint::Tests
class Like < Related::Entity
validates_numericality_of :how_much, :allow_nil => true
before_save :before_save_callback
after_save :after_save_callback
before_create :before_... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/test/performance_test.rb | test/performance_test.rb | require File.expand_path('test/test_helper')
require 'benchmark'
class PerformanceTest < MiniTest::Unit::TestCase
def setup
Related.flushall
end
def test_simple
puts "Simple:"
node = Related::Node.create
time = Benchmark.measure do
1000.times do
n = Related::Node.create
re... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related.rb | lib/related.rb | require 'redis'
require 'redis/namespace'
require 'active_model'
require 'related/version'
require 'related/helpers'
require 'related/exceptions'
require 'related/validations/check_redis_uniqueness'
require 'related/entity'
require 'related/node'
require 'related/relationship'
require 'related/root'
require 'related/d... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related/follower.rb | lib/related/follower.rb | module Related
module Follower
def follow!(other)
Related::Relationship.create(:follow, self, other)
end
def unfollow!(other)
rel = self.following.relationships.find(other)
rel.destroy if rel
end
def followers
self.incoming(:follow)
end
def following
self.o... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related/version.rb | lib/related/version.rb | module Related
Version = VERSION = '0.6.6'
end
| ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related/exceptions.rb | lib/related/exceptions.rb | module Related
class RelatedException < RuntimeError; end
class NotFound < RelatedException; end
class InvalidQuery < RelatedException; end
class ValidationsFailed < RelatedException
attr_reader :object
def initialize(object)
@object = object
errors = @object.errors.full_messages.to_sentence... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related/relationship.rb | lib/related/relationship.rb | module Related
class Relationship < Entity
validates_presence_of :label, :start_node_id, :end_node_id
def initialize(*attributes)
@_internal_id = attributes.first.is_a?(String) ? attributes.first : Related.generate_id
@attributes = attributes.last
end
def start_node
@start_node ||... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related/node.rb | lib/related/node.rb | module Related
class Node < Entity
module QueryMethods
def relationships
query = self.query
query.result_type = :relationships
query
end
def nodes
query = self.query
query.result_type = :nodes
query
end
def options(opt)
query ... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related/entity.rb | lib/related/entity.rb | module Related
class Entity
extend ActiveModel::Naming
extend ActiveModel::Callbacks
include ActiveModel::Conversion
include ActiveModel::Validations
include ActiveModel::Serializers::JSON
include ActiveModel::Serializers::Xml
include ActiveModel::Translation
include ActiveModel::Attri... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related/data_flow.rb | lib/related/data_flow.rb | module Related
module DataFlow
def data_flow(name, steps)
@data_flows ||= {}
@data_flows[name.to_sym] ||= []
@data_flows[name.to_sym] << steps
end
def data_flows
@data_flows
end
def clear_data_flows
@data_flows = {}
end
def execute_data_flow(name_or_flow, ... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related/helpers.rb | lib/related/helpers.rb | require 'base64'
require 'digest/md5'
module Related
module Helpers
# Generate a unique id
def generate_id
Base64.encode64(
Digest::MD5.digest("#{Time.now}-#{rand}")
).gsub('/','x').gsub('+','y').gsub('=','').strip
end
# Returns the root node for the graph
def root
@ro... | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related/root.rb | lib/related/root.rb | module Related
class Root < Related::Node
def initialize(attributes = {})
@id = 'root'
super(attributes)
end
end
end
| ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
niho/related | https://github.com/niho/related/blob/c18d66911c4f08ed7422d2122bc2fbfdb0274c8f/lib/related/validations/check_redis_uniqueness.rb | lib/related/validations/check_redis_uniqueness.rb | module Related
class CheckRedisUniqueness < ActiveModel::Validator
def validate(entity)
internal_id = entity.instance_variable_get(:@_internal_id)
if Related.redis.exists(internal_id)
entity.errors[:id] << "#{internal_id.inspect} already exists."
end
end
end
end | ruby | MIT | c18d66911c4f08ed7422d2122bc2fbfdb0274c8f | 2026-01-04T17:48:29.697273Z | false |
sagmor/sii_chile | https://github.com/sagmor/sii_chile/blob/3600424a5b85ff948f7a5bee420e92798cc55307/app/sii_chile/application.rb | app/sii_chile/application.rb | require 'sii_chile'
require 'sinatra'
require 'dalli'
require 'rack/contrib/jsonp'
require 'multi_json'
require 'newrelic_rpm'
module SIIChile
class Application < Sinatra::Base
set :cache, Dalli::Client.new(ENV["MEMCACHIER_SERVERS"].split(","),
{:username => ENV["MEMCACHIER_USERNAME"],
... | ruby | MIT | 3600424a5b85ff948f7a5bee420e92798cc55307 | 2026-01-04T17:48:25.496512Z | false |
sagmor/sii_chile | https://github.com/sagmor/sii_chile/blob/3600424a5b85ff948f7a5bee420e92798cc55307/gem/lib/sii_chile.rb | gem/lib/sii_chile.rb | require 'faraday'
require 'nokogiri'
require "sii_chile/version"
require "sii_chile/rut"
require "sii_chile/consulta"
| ruby | MIT | 3600424a5b85ff948f7a5bee420e92798cc55307 | 2026-01-04T17:48:25.496512Z | false |
sagmor/sii_chile | https://github.com/sagmor/sii_chile/blob/3600424a5b85ff948f7a5bee420e92798cc55307/gem/lib/sii_chile/version.rb | gem/lib/sii_chile/version.rb | module SIIChile
VERSION = "0.1.4"
end
| ruby | MIT | 3600424a5b85ff948f7a5bee420e92798cc55307 | 2026-01-04T17:48:25.496512Z | false |
sagmor/sii_chile | https://github.com/sagmor/sii_chile/blob/3600424a5b85ff948f7a5bee420e92798cc55307/gem/lib/sii_chile/consulta.rb | gem/lib/sii_chile/consulta.rb | require 'json'
require 'base64'
module SIIChile
class Consulta
attr_reader :rut
def initialize(rut)
@rut = Rut.new(rut)
end
def resultado
@resultado ||= self.fetch!
end
protected
XPATH_RAZON_SOCIAL = '/html/body/div/div[4]'
XPATH_ACTIVIDADES = '/html/body/div/table[... | ruby | MIT | 3600424a5b85ff948f7a5bee420e92798cc55307 | 2026-01-04T17:48:25.496512Z | false |
sagmor/sii_chile | https://github.com/sagmor/sii_chile/blob/3600424a5b85ff948f7a5bee420e92798cc55307/gem/lib/sii_chile/rut.rb | gem/lib/sii_chile/rut.rb | module SIIChile
# "Stealed" from https://github.com/iortega/rut_validator/blob/master/lib/rut_validator/rut.rb
class Rut
attr_reader :number
attr_reader :code
def initialize(rut)
@rut = rut.to_s.strip
@number = @rut.gsub(/[^0-9K]/i,'')[0...-1]
@code = @rut[-1].upcase
end
def ... | ruby | MIT | 3600424a5b85ff948f7a5bee420e92798cc55307 | 2026-01-04T17:48:25.496512Z | false |
sagmor/sii_chile | https://github.com/sagmor/sii_chile/blob/3600424a5b85ff948f7a5bee420e92798cc55307/spec/spec_helper.rb | spec/spec_helper.rb | RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
end
| ruby | MIT | 3600424a5b85ff948f7a5bee420e92798cc55307 | 2026-01-04T17:48:25.496512Z | false |
sagmor/sii_chile | https://github.com/sagmor/sii_chile/blob/3600424a5b85ff948f7a5bee420e92798cc55307/spec/integration/sii_consulta.rb | spec/integration/sii_consulta.rb | require 'faraday'
require 'nokogiri'
require File.expand_path('gem/lib/sii_chile/version')
require File.expand_path('gem/lib/sii_chile/rut')
require File.expand_path('gem/lib/sii_chile/consulta')
describe "Materialización del objeto y resultados" do
before do
@sii_chile_rut = "76.118.195-5"
@sii_chile = SIIC... | ruby | MIT | 3600424a5b85ff948f7a5bee420e92798cc55307 | 2026-01-04T17:48:25.496512Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/constant/text/setup.rb | yard/templates/mathjax/constant/text/setup.rb | def init
sections :header, [T('docstring')]
end
| ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/root/dot/setup.rb | yard/templates/mathjax/root/dot/setup.rb | include T('default/module/dot')
def format_path(object)
""
end | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/root/html/setup.rb | yard/templates/mathjax/root/html/setup.rb | include T('default/module/html') | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/fulldoc/html/setup.rb | yard/templates/mathjax/fulldoc/html/setup.rb | include Helpers::ModuleHelper
def init
options.objects = objects = run_verifier(options.objects)
return serialize_onefile if options.onefile
generate_assets
serialize('_index.html')
options.files.each_with_index do |file, i|
serialize_file(file, file.title)
end
options.delete(:objects)
options.de... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/tags/setup.rb | yard/templates/mathjax/tags/setup.rb | def init
tags = Tags::Library.visible_tags - [:abstract, :deprecated, :note, :todo]
create_tag_methods(tags - [:example, :option, :overload, :see])
sections :index, tags.map {|t| t.to_s.gsub('.', '_').to_sym }
sections.any(:overload).push(T('docstring'))
end
def return
if object.type == :method
return if... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/method_details/setup.rb | yard/templates/mathjax/method_details/setup.rb | def init
sections :header, [:method_signature, T('docstring'), :source]
end
def source
return if owner != object.namespace
return if Tags::OverloadTag === object
return if object.source.nil?
erb(:source)
end
| ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/method_details/text/setup.rb | yard/templates/mathjax/method_details/text/setup.rb | def init
super
sections.last.pop
end
def format_object_title(object)
title = "Method: #{object.name(true)}"
title += " (#{object.namespace})" if !object.namespace.root?
title
end | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/method/setup.rb | yard/templates/mathjax/method/setup.rb | def init
sections :header, [T('method_details')]
end | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/layout/dot/setup.rb | yard/templates/mathjax/layout/dot/setup.rb | attr_reader :contents
def init
if object
type = object.root? ? :module : object.type
sections :header, [T(type)]
else
sections :header, [:contents]
end
end
def header
tidy erb(:header)
end
| ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/layout/html/setup.rb | yard/templates/mathjax/layout/html/setup.rb | def init
@breadcrumb = []
if @onefile
sections :layout
elsif @file
if @file.attributes[:namespace]
@object = options.object = Registry.at(@file.attributes[:namespace]) || Registry.root
end
@breadcrumb_title = "File: " + @file.title
@page_title = @breadcrumb_title
sections :layout, [:... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/docstring/setup.rb | yard/templates/mathjax/docstring/setup.rb | def init
return if object.docstring.blank? && !object.has_tag?(:api)
sections :index, [:private, :deprecated, :abstract, :todo, :note, :returns_void, :text], T('tags')
end
def private
return unless object.has_tag?(:api) && object.tag(:api).text == 'private'
erb(:private)
end
def abstract
return unless objec... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/class/setup.rb | yard/templates/mathjax/class/setup.rb | include T('default/module')
def init
super
sections.place(:subclasses).before(:children)
sections.place(:constructor_details, [T('method_details')]).before(:methodmissing)
end
def constructor_details
ctors = object.meths(:inherited => true, :included => true)
return unless @ctor = ctors.find {|o| o.construc... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/class/dot/setup.rb | yard/templates/mathjax/class/dot/setup.rb | include T('default/module/dot')
def init
super
sections.push :superklass
end | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/class/html/setup.rb | yard/templates/mathjax/class/html/setup.rb | include T('default/module/html') | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/class/text/setup.rb | yard/templates/mathjax/class/text/setup.rb | include T('default/module/text')
def init
super
sections.place(:subclasses).before(:children)
sections.delete(:children)
end
def format_object_title(object)
"Class: #{object.title} < #{object.superclass.title}"
end | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/module/setup.rb | yard/templates/mathjax/module/setup.rb | include Helpers::ModuleHelper
def init
sections :header, :box_info, :pre_docstring, T('docstring'), :children,
:constant_summary, [T('docstring')], :inherited_constants,
:attribute_summary, [:item_summary], :inherited_attributes,
:method_summary, [:item_summary], :inherited_methods,
:methodmissing, [... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/module/dot/setup.rb | yard/templates/mathjax/module/dot/setup.rb | def init
@modules = object.children.select {|o| o.type == :module }
@classes = object.children.select {|o| o.type == :class }
sections :child, [:info], :classes, [T('class')], :header, [T('module')], :dependencies
end
def dependencies
return unless options.dependencies
erb(:dependencies)
end
def classes
@... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/module/text/setup.rb | yard/templates/mathjax/module/text/setup.rb | def init
sections :header, [T('docstring')], :children, :includes, :extends,
:class_meths_list, :instance_meths_list
end
def class_meths
@classmeths ||= method_listing.select {|o| o.scope == :class }
end
def instance_meths
@instmeths ||= method_listing.select {|o| o.scope == :instance }
end | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/yard/templates/mathjax/onefile/html/setup.rb | yard/templates/mathjax/onefile/html/setup.rb | include T('default/layout/html')
include YARD::Parser::Ruby::Legacy
def init
override_serializer
@object = YARD::Registry.root
@files.shift
@objects.delete(YARD::Registry.root)
@objects.unshift(YARD::Registry.root)
sections :layout, [:readme, :files, :all_objects]
end
def all_objects
@objects.map {|obj|... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/test/run-test.rb | test/run-test.rb | $VERBOSE = true
base_dir = File.expand_path("../..", __FILE__)
lib_dir = File.join(base_dir, "lib")
test_dir = File.join(base_dir, "test")
$LOAD_PATH.unshift(lib_dir)
require "test/unit"
require "enumerable/statistics"
exit Test::Unit::AutoRunner.run(true, test_dir)
| ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/test/test-ractor.rb | test/test-ractor.rb | if defined?(Ractor)
class Ractor
alias_method :value, :take unless method_defined?(:value)
end
end
class RactorTest < Test::Unit::TestCase
ractor
test("Array#mean") do
r = Ractor.new do
[1, 2, 3, 4].mean
end
assert_equal(2.5, r.value)
end
end
| ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/test/test-array.rb | test/test-array.rb | class ArrayTest < Test::Unit::TestCase
sub_test_case("find_max and argmax") do
data(:case, [
{ array: [3, 6, 2, 4, 9, 1, 2, 9], result: [9, 4] },
{ array: [3, 6, 2, 4, 3, 1, 2, 8], result: [8, 7] },
{ array: [7, 6, 2, 4, 3, 1, 2, 6], result: [7, 0] }
])
def test_find_max(data)
arra... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/test/test-sum.rb | test/test-sum.rb | require "delegate"
class SumTest < Test::Unit::TestCase
large_number = 100_000_000
small_number = 1e-9
until (large_number + small_number) == large_number
small_number /= 10
end
generic_test_data = [
[ [], 0, 0 ],
[ [], 0.0, 0.0 ],
[ [3], 0, 3 ],
[ [3], 0.0, 3.0 ],
[ [3, 5], 0, 8 ],
... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/ext/enumerable/statistics/extension/extconf.rb | ext/enumerable/statistics/extension/extconf.rb | require 'mkmf'
have_type('struct RRational')
have_func('rb_rational_new')
have_func('rb_rational_num')
have_func('rb_rational_den')
have_func('rb_rational_plus')
have_type('struct RComplex')
have_func('rb_complex_raw')
have_func('rb_complex_real')
have_func('rb_complex_imag')
have_func('rb_complex_plus')
have_func('r... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/spec/array_spec.rb | spec/array_spec.rb | require 'spec_helper'
require 'enumerable/statistics'
require 'delegate'
RSpec.describe Array do
describe '#mean' do
let(:ary) { [] }
let(:block) { nil }
subject(:mean) { ary.mean(&block) }
with_array [] do
it_is_float_equal(0.0)
context 'with a conversion block' do
it_is_float... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/spec/enum_spec.rb | spec/enum_spec.rb | require 'spec_helper'
require 'enumerable/statistics'
require 'delegate'
RSpec.describe Enumerable do
describe '#mean' do
subject(:mean) { enum.mean(&block) }
let(:block) { nil }
with_enum [] do
it_is_float_equal(0.0)
context 'with a conversion block' do
it_is_float_equal(0.0)
... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/spec/range_spec.rb | spec/range_spec.rb | require 'spec_helper'
require 'enumerable/statistics'
require 'delegate'
RSpec.describe Enumerable do
describe '#sum' do
subject(:sum) { enum.sum(init, &block) }
let(:init) { 0 }
let(:block) { nil }
with_enum 1..0 do
it_is_int_equal(0)
with_init(0.0) do
it_is_float_equal(0.0)
... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/spec/hash_spec.rb | spec/hash_spec.rb | require 'spec_helper'
require 'enumerable/statistics'
require 'delegate'
RSpec.describe Hash do
describe '#sum' do
subject(:sum) { enum.sum(init, &block) }
let(:init) { 0 }
let(:block) { nil }
with_enum({}) do
it_is_int_equal(0)
with_init(0.0) do
it_is_float_equal(0.0)
end... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/spec/value_counts_spec.rb | spec/value_counts_spec.rb | require 'spec_helper'
require 'enumerable/statistics'
RSpec.shared_examples_for 'value_counts' do
matrix = [
{ normalize: false, sort: true, ascending: false, dropna: true,
result: {"g"=>11, "b"=>10, "f"=>6, "e"=>4, "a"=>3, "c"=>3, "d"=>3} },
{ normalize: false, sort: true, ascending: false, dropna: ... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/spec/spec_helper.rb | spec/spec_helper.rb | RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.filter_run :focus
config.run_all_when_everything_filtered = true
... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/spec/support/macros.rb | spec/support/macros.rb | module Enumerable
module Statistics
module RSpecMacros
def self.included(mod)
mod.module_eval do
extend ExampleGroupMethods
end
end
module ExampleGroupMethods
def with_array(given_ary, &example_group_block)
describe "for #{given_ary.inspect}" do
... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/spec/histogram/array_spec.rb | spec/histogram/array_spec.rb | require 'spec_helper'
require 'enumerable/statistics'
RSpec.describe Array, '#histogram' do
let(:ary) { [] }
let(:args) { [] }
let(:kwargs) { {} }
subject(:histogram) { ary.histogram(*args, **kwargs) }
with_array [] do
context 'default' do
specify do
expect(histogram.edges).to eq([0.0])
... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/spec/percentile/array_spec.rb | spec/percentile/array_spec.rb | require 'spec_helper'
RSpec.describe Array, '#percentile' do
let(:ary) { [] }
let(:args) { [0, 25, 50, 75, 100] }
subject(:percentile) { ary.percentile(args) }
with_array [] do
specify do
expect { percentile }.to raise_error(ArgumentError)
end
end
with_array [1] do
specify do
exp... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/spec/median/array_spec.rb | spec/median/array_spec.rb | require 'spec_helper'
RSpec.describe Array, '#median' do
let(:ary) { [] }
subject(:median) { ary.median }
with_array [] do
it_is_float_nan
end
with_array [1] do
it_is_int_equal(1)
end
with_array [0, 1] do
it_is_float_equal(0.5)
end
with_array [0.0444502, 0.0463301, 0.141249, 0.060677... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/lib/enumerable_statistics.rb | lib/enumerable_statistics.rb | require_relative "enumerable_statistics/version"
require_relative "enumerable_statistics/array_ext"
require_relative "enumerable_statistics/histogram"
| ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/lib/enumerable/statistics.rb | lib/enumerable/statistics.rb | require "enumerable_statistics"
require "enumerable/statistics/extension"
| ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/lib/enumerable_statistics/version.rb | lib/enumerable_statistics/version.rb | module EnumerableStatistics
VERSION = '2.1.0'
module Version
numbers, TAG = VERSION.split('-', 2)
MAJOR, MINOR, MICRO = numbers.split('.', 3).map(&:to_i)
STRING = VERSION
end
end
| ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/lib/enumerable_statistics/array_ext.rb | lib/enumerable_statistics/array_ext.rb | module EnumerableStatistics
module ArrayExtension
def find_max
n = size
return nil if n == 0
imax, i = 0, 1
while i < n
imax = i if self[i] > self[imax]
i += 1
end
[self[imax], imax]
end
def argmax
find_max[1]
end
def find_min
n = ... | ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
red-data-tools/enumerable-statistics | https://github.com/red-data-tools/enumerable-statistics/blob/480765c1e114d6166f98756546243e2a9ee6488e/lib/enumerable_statistics/histogram.rb | lib/enumerable_statistics/histogram.rb | module EnumerableStatistics
class Histogram < Struct.new(:edges, :weights, :closed, :isdensity)
alias edge edges
alias density? isdensity
end
end
| ruby | MIT | 480765c1e114d6166f98756546243e2a9ee6488e | 2026-01-04T17:48:35.335590Z | false |
lewagon/foot_traffic | https://github.com/lewagon/foot_traffic/blob/a3e577c2f1d3222f2b8d279465823061584d4a60/spec/foot_traffic_spec.rb | spec/foot_traffic_spec.rb | RSpec.describe FootTraffic do
it "has a version number" do
expect(FootTraffic::VERSION).not_to be nil
end
end
| ruby | MIT | a3e577c2f1d3222f2b8d279465823061584d4a60 | 2026-01-04T17:48:16.406321Z | false |
lewagon/foot_traffic | https://github.com/lewagon/foot_traffic/blob/a3e577c2f1d3222f2b8d279465823061584d4a60/spec/spec_helper.rb | spec/spec_helper.rb | require "bundler/setup"
require "foot_traffic"
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!
config.expect_with... | ruby | MIT | a3e577c2f1d3222f2b8d279465823061584d4a60 | 2026-01-04T17:48:16.406321Z | false |
lewagon/foot_traffic | https://github.com/lewagon/foot_traffic/blob/a3e577c2f1d3222f2b8d279465823061584d4a60/examples/cookies.rb | examples/cookies.rb | require "concurrent" # concurrent-ruby
tokens = [] # imaginary array of auth tokens
cookies = Concurrent::Hash.new
opts = {
headless: false, # Headless or not
timeout: 300, # How long to wait for new tab to open, set for high value
slowmo: 0.1, # How fast do you want bots to type
window_size: [1200, 800]
}
... | ruby | MIT | a3e577c2f1d3222f2b8d279465823061584d4a60 | 2026-01-04T17:48:16.406321Z | false |
lewagon/foot_traffic | https://github.com/lewagon/foot_traffic/blob/a3e577c2f1d3222f2b8d279465823061584d4a60/examples/multi_threaded.rb | examples/multi_threaded.rb | require "foot_traffic"
using FootTraffic
FootTraffic::Session.start do |window|
window.tab_thread { |tab| tab.goto "https://www.lewagon.com" }
window.tab_thread { |tab| tab.goto "https://www.lewagon.com/berlin" }
window.tab_thread do |paris|
paris.goto "https://www.lewagon.com/paris"
paris.at_css('[href=... | ruby | MIT | a3e577c2f1d3222f2b8d279465823061584d4a60 | 2026-01-04T17:48:16.406321Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.