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
rubycdp/ferrum
https://github.com/rubycdp/ferrum/blob/bd9b9019ad12475126b7562179b3c11270b5e9bd/lib/ferrum/browser/options/firefox.rb
lib/ferrum/browser/options/firefox.rb
# frozen_string_literal: true module Ferrum class Browser class Options class Firefox < Base DEFAULT_OPTIONS = { "headless" => nil }.freeze MAC_BIN_PATH = [ "/Applications/Firefox.app/Contents/MacOS/firefox-bin" ].freeze LINUX_BIN_PATH = %w[firef...
ruby
MIT
bd9b9019ad12475126b7562179b3c11270b5e9bd
2026-01-04T15:59:29.143722Z
false
rubycdp/ferrum
https://github.com/rubycdp/ferrum/blob/bd9b9019ad12475126b7562179b3c11270b5e9bd/lib/ferrum/browser/options/base.rb
lib/ferrum/browser/options/base.rb
# frozen_string_literal: true require "singleton" require "open3" module Ferrum class Browser class Options class Base include Singleton def self.options instance end # @return [String, nil] def self.version out, = Open3.capture2(instance.detec...
ruby
MIT
bd9b9019ad12475126b7562179b3c11270b5e9bd
2026-01-04T15:59:29.143722Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/mktree.rb
mktree.rb
#!/usr/bin/env bundle exec ruby -I lib:spec # frozen_string_literal: true # Simple benchmark utility to create a closure tree based on the topology of the current filesystem # ENV['NONUKES'] = '1' require 'spec_helper' require 'findler' require 'pathname' # Returns the current path, split into an array. # Pathname.n...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/test_helper.rb
test/test_helper.rb
# frozen_string_literal: true require 'securerandom' ENV['RAILS_ENV'] = 'test' ENV['WITH_ADVISORY_LOCK_PREFIX'] ||= SecureRandom.hex require 'dotenv' Dotenv.load require_relative 'dummy/config/environment' require 'rails/test_help' require 'with_advisory_lock' require 'minitest/autorun' require 'database_cleaner' r...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/support/query_counter.rb
test/support/query_counter.rb
# frozen_string_literal: true # https://stackoverflow.com/a/43810063/1683557 module QueryCounter def sql_queries(&) queries = [] counter = lambda { |*, payload| queries << payload.fetch(:sql) unless %w[CACHE SCHEMA].include?(payload.fetch(:name)) } ActiveSupport::Notifications.subscribed(coun...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/support/tag_examples.rb
test/support/tag_examples.rb
# frozen_string_literal: true require 'active_support/concern' module TagExamples extend ActiveSupport::Concern included do def setup super @tag_class = self.class.const_get(:TAG_CLASS) || Tag @tag_hierarchy_class = @tag_class.hierarchy_class # Clean up any existing data to ensure tes...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
true
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/controllers/application_controller.rb
test/dummy/app/controllers/application_controller.rb
# frozen_string_literal: true class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/unobtanium.rb
test/dummy/app/models/unobtanium.rb
# frozen_string_literal: true class Unobtanium < Metal end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/tag.rb
test/dummy/app/models/tag.rb
# frozen_string_literal: true class Tag < ApplicationRecord has_closure_tree dependent: :destroy, order: :name before_destroy :add_destroyed_tag def to_s name end def add_destroyed_tag # Proof for the tests that the destroy rather than the delete method was called: DestroyedTag.create(name: to_...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/directory_label.rb
test/dummy/app/models/directory_label.rb
# frozen_string_literal: true class DirectoryLabel < Label end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/label_without_root_ordering.rb
test/dummy/app/models/label_without_root_ordering.rb
# frozen_string_literal: true class LabelWithoutRootOrdering < ActiveRecord::Base self.table_name = 'labels' has_closure_tree parent_column_name: 'mother_id', name_column: 'name', order: 'column_whereby_ordering_is_inferred', numeric_order: true, ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/menu_item.rb
test/dummy/app/models/menu_item.rb
# frozen_string_literal: true class MenuItem < ApplicationRecord has_closure_tree touch: true, with_advisory_lock: false end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/date_label.rb
test/dummy/app/models/date_label.rb
# frozen_string_literal: true class DateLabel < Label end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/contract.rb
test/dummy/app/models/contract.rb
# frozen_string_literal: true class Contract < ApplicationRecord belongs_to :user, inverse_of: :contracts belongs_to :contract_type, inverse_of: :contracts, optional: true end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/group.rb
test/dummy/app/models/group.rb
# frozen_string_literal: true class Group < ApplicationRecord has_closure_tree_root :root_user end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/mysql_record.rb
test/dummy/app/models/mysql_record.rb
# frozen_string_literal: true class MysqlRecord < ApplicationRecord self.abstract_class = true connects_to database: { writing: :secondary, reading: :secondary } end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/user_set.rb
test/dummy/app/models/user_set.rb
# frozen_string_literal: true class UserSet < ApplicationRecord has_closure_tree_root :root_user, class_name: 'User' end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/namespace.rb
test/dummy/app/models/namespace.rb
# frozen_string_literal: true module Namespace def self.table_name_prefix 'namespace_' end end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/destroyed_tag.rb
test/dummy/app/models/destroyed_tag.rb
# frozen_string_literal: true class DestroyedTag < ApplicationRecord end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/event_label.rb
test/dummy/app/models/event_label.rb
# frozen_string_literal: true class EventLabel < Label end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/multi_scoped_item.rb
test/dummy/app/models/multi_scoped_item.rb
# frozen_string_literal: true class MultiScopedItem < ApplicationRecord self.table_name = 'scoped_items' has_closure_tree order: :sort_order, numeric_order: true, scope: [:user_id, :group_id] end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/sqlite_record.rb
test/dummy/app/models/sqlite_record.rb
# frozen_string_literal: true class SqliteRecord < ApplicationRecord self.abstract_class = true connects_to database: { writing: :sqlite, reading: :sqlite } end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/grouping.rb
test/dummy/app/models/grouping.rb
# frozen_string_literal: true class Grouping < ApplicationRecord has_closure_tree_root :root_person, class_name: 'User', foreign_key: :group_id end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/scoped_item.rb
test/dummy/app/models/scoped_item.rb
# frozen_string_literal: true class ScopedItem < ApplicationRecord has_closure_tree order: :sort_order, numeric_order: true, scope: :user_id end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/mysql_adoptable_tag.rb
test/dummy/app/models/mysql_adoptable_tag.rb
# frozen_string_literal: true class MysqlAdoptableTag < MysqlRecord has_closure_tree dependent: :adopt, name_column: 'name' end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/application_record.rb
test/dummy/app/models/application_record.rb
# frozen_string_literal: true class ApplicationRecord < ActiveRecord::Base self.abstract_class = true establish_connection(:primary) end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/contract_type.rb
test/dummy/app/models/contract_type.rb
# frozen_string_literal: true class ContractType < ApplicationRecord has_many :contracts, inverse_of: :contract_type end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/team.rb
test/dummy/app/models/team.rb
# frozen_string_literal: true class Team < ApplicationRecord has_closure_tree_root :root_user, class_name: 'User', foreign_key: :grp_id end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/adamantium.rb
test/dummy/app/models/adamantium.rb
# frozen_string_literal: true class Adamantium < Metal end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/adoptable_tag.rb
test/dummy/app/models/adoptable_tag.rb
# frozen_string_literal: true class AdoptableTag < ApplicationRecord has_closure_tree dependent: :adopt, name_column: 'name' end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/metal.rb
test/dummy/app/models/metal.rb
# frozen_string_literal: true class Metal < ApplicationRecord self.table_name = "#{table_name_prefix}metal#{table_name_suffix}" has_closure_tree order: 'sort_order', name_column: 'value' self.inheritance_column = 'metal_type' end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/cuisine_type.rb
test/dummy/app/models/cuisine_type.rb
# frozen_string_literal: true class CuisineType < ApplicationRecord acts_as_tree end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/mysql_tag.rb
test/dummy/app/models/mysql_tag.rb
# frozen_string_literal: true class MysqlTag < MysqlRecord has_closure_tree end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/uuid_tag.rb
test/dummy/app/models/uuid_tag.rb
# frozen_string_literal: true class UuidTag < ApplicationRecord self.primary_key = :uuid before_create :set_uuid has_closure_tree dependent: :destroy, order: 'name', parent_column_name: 'parent_uuid' before_destroy :add_destroyed_tag def set_uuid self.uuid = SecureRandom.uuid end def to_s name ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/schema_type.rb
test/dummy/app/models/schema_type.rb
# frozen_string_literal: true class SchemaType < ApplicationRecord self.table_name = 'test_schema.schema_types' has_closure_tree order: :name def to_s name end end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/label.rb
test/dummy/app/models/label.rb
# frozen_string_literal: true class Label < ApplicationRecord # make sure order doesn't matter acts_as_tree order: :column_whereby_ordering_is_inferred, # <- symbol, and not "sort_order" numeric_order: true, parent_column_name: 'mother_id', dependent: :destroy def to...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/memory_adoptable_tag.rb
test/dummy/app/models/memory_adoptable_tag.rb
# frozen_string_literal: true class MemoryAdoptableTag < SqliteRecord has_closure_tree dependent: :adopt, name_column: 'name' end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/user.rb
test/dummy/app/models/user.rb
# frozen_string_literal: true class User < ApplicationRecord acts_as_tree parent_column_name: 'referrer_id', name_column: 'email', hierarchy_class_name: 'ReferralHierarchy', hierarchy_table_name: 'referral_hierarchies' has_many :contracts, inverse_of: :user belongs_t...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/memory_tag.rb
test/dummy/app/models/memory_tag.rb
# frozen_string_literal: true class MemoryTag < SqliteRecord has_closure_tree end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/app/models/namespace/type.rb
test/dummy/app/models/namespace/type.rb
# frozen_string_literal: true module Namespace class Type < ApplicationRecord has_closure_tree dependent: :destroy end end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/db/secondary_schema.rb
test/dummy/db/secondary_schema.rb
# frozen_string_literal: true # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define yo...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/db/sqlite_schema.rb
test/dummy/db/sqlite_schema.rb
# frozen_string_literal: true # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define yo...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/db/mysql_schema.rb
test/dummy/db/mysql_schema.rb
# frozen_string_literal: true ActiveRecord::Schema.define(version: 1) do create_table 'mysql_tags', force: true do |t| t.string 'name' end create_table 'mysql_tag_audits', id: false, force: true do |t| t.string 'tag_name' end create_table 'mysql_labels', id: false, force: true do |t| t.string '...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/db/schema.rb
test/dummy/db/schema.rb
# frozen_string_literal: true ActiveRecord::Schema.define(version: 1) do create_table 'tags' do |t| t.string 'name' t.string 'title' t.references 'parent' t.integer 'sort_order' t.timestamps null: false end create_table 'tag_hierarchies', id: false do |t| t.references 'ancestor', null: f...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/config/application.rb
test/dummy/config/application.rb
# frozen_string_literal: true require File.expand_path('boot', __dir__) require 'rails' require 'active_model/railtie' require 'active_record/railtie' Bundler.require(*Rails.groups) require 'closure_tree' module Dummy class Application < Rails::Application config.load_defaults [Rails::VERSION::MAJOR, Rails::V...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/config/environment.rb
test/dummy/config/environment.rb
# frozen_string_literal: true # Load the Rails application. require_relative 'application' # Initialize the Rails application. Rails.application.initialize!
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/config/boot.rb
test/dummy/config/boot.rb
# frozen_string_literal: true ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/dummy/config/environments/test.rb
test/dummy/config/environments/test.rb
# frozen_string_literal: true Rails.application.configure do config.cache_classes = true config.eager_load = false config.consider_all_requests_local = true config.action_controller.perform_caching = false config.action_dispatch.show_exceptions = false config.active_support.deprecation = :stderr config.a...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/tag_test.rb
test/closure_tree/tag_test.rb
# frozen_string_literal: true require 'test_helper' require 'support/tag_examples' class TagTest < ActiveSupport::TestCase TAG_CLASS = Tag include TagExamples end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/user_test.rb
test/closure_tree/user_test.rb
# frozen_string_literal: true require 'test_helper' describe 'empty db' do before do User.delete_all User.hierarchy_class.delete_all end describe 'empty db' do it 'should return no entities' do assert User.roots.empty? assert User.leaves.empty? end end describe '1 user db' do ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/scope_test.rb
test/closure_tree/scope_test.rb
# frozen_string_literal: true require 'test_helper' class ScopeTest < ActiveSupport::TestCase def setup ScopedItem.delete_all ScopedItemHierarchy.delete_all MultiScopedItem.delete_all end def test_roots_with_single_scope root1 = ScopedItem.create!(name: 'root1', user_id: 1) root2 = ScopedIt...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/advisory_lock_test.rb
test/closure_tree/advisory_lock_test.rb
# frozen_string_literal: true require 'test_helper' # Test for advisory lock name customization class AdvisoryLockTest < ActiveSupport::TestCase def setup Tag.delete_all Tag.hierarchy_class.delete_all end def test_default_advisory_lock_name tag = Tag.new expected_name = "ct_#{Zlib.crc32(Tag.bas...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/generator_test.rb
test/closure_tree/generator_test.rb
# frozen_string_literal: true require 'test_helper' require 'generators/closure_tree/migration_generator' module ClosureTree module Generators class MigrationGeneratorTest < Rails::Generators::TestCase tests MigrationGenerator destination File.expand_path('../tmp', __dir__) setup :prepare_dest...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/has_closure_tree_root_test.rb
test/closure_tree/has_closure_tree_root_test.rb
# frozen_string_literal: true require 'test_helper' class HasClosureTreeRootTest < ActiveSupport::TestCase setup do ENV['FLOCK_DIR'] = Dir.mktmpdir end teardown do FileUtils.remove_entry_secure ENV.fetch('FLOCK_DIR', nil) end def create_tree(group) @ct1 = ContractType.create!(name: 'Type1') ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/uuid_tag_test.rb
test/closure_tree/uuid_tag_test.rb
# frozen_string_literal: true require 'test_helper' require 'support/tag_examples' describe UuidTag do TAG_CLASS = UuidTag include TagExamples end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/model_test.rb
test/closure_tree/model_test.rb
# frozen_string_literal: true require 'test_helper' describe '#_ct' do it 'should delegate to the Support instance on the class' do assert_equal Tag._ct, Tag.new._ct end end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/label_test.rb
test/closure_tree/label_test.rb
# frozen_string_literal: true require 'test_helper' module CorrectOrderValue def self.shared_examples(model, expected_root_order_value) describe 'correct order_value' do before do @model = model @expected_root_order_value = expected_root_order_value # Clean up any existing data ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/cache_invalidation_test.rb
test/closure_tree/cache_invalidation_test.rb
# frozen_string_literal: true require 'test_helper' class CacheInvalidationTest < ActiveSupport::TestCase def setup Timecop.travel(10.seconds.ago) do # create a long tree with 2 branch @root = MenuItem.create( name: SecureRandom.hex(10) ) 2.times do parent = @root ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/adopt_test.rb
test/closure_tree/adopt_test.rb
# frozen_string_literal: true require 'test_helper' def run_adopt_tests_for(model_class) describe "#{model_class} with dependent: :adopt" do before do model_class.delete_all model_class.hierarchy_class.delete_all end it 'moves children to grandparent when parent is destroyed and updates hie...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/schema_type_test.rb
test/closure_tree/schema_type_test.rb
# frozen_string_literal: true require 'test_helper' describe SchemaType do before do skip 'PostgreSQL only' unless postgresql? end def assert_lineage(parent, child) assert_equal parent, child.parent assert_equal [child, parent], child.self_and_ancestors # make sure reloading doesn't affect the...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/hierarchy_maintenance_test.rb
test/closure_tree/hierarchy_maintenance_test.rb
# frozen_string_literal: true require 'test_helper' describe ClosureTree::HierarchyMaintenance do describe '.rebuild!' do it 'rebuild tree' do 20.times do |counter| Metal.create(value: "Nitro-#{counter}", parent: Metal.all.sample) end hierarchy_count = MetalHierarchy.count assert...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/hierarchy_inheritance_test.rb
test/closure_tree/hierarchy_inheritance_test.rb
# frozen_string_literal: true require 'test_helper' class HierarchyInheritanceTest < ActiveSupport::TestCase # Test for issue #392: Hierarchy class should inherit from same abstract base as model # but NOT from STI parent (to avoid inheriting validations/callbacks) test 'MetalHierarchy inherits from same connec...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/metal_test.rb
test/closure_tree/metal_test.rb
# frozen_string_literal: true require 'test_helper' describe Metal do describe '#find_or_create_by_path' do def assert_correctness(grandchild) assert(Metal, grandchild) assert_equal 'slag', grandchild.description child = grandchild.parent assert(Unobtanium, child) assert_equal 'fra...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/cuisine_type_test.rb
test/closure_tree/cuisine_type_test.rb
# frozen_string_literal: true require 'test_helper' def assert_lineage(e, m) assert_equal e, m.parent assert_equal [m, e], m.self_and_ancestors # make sure reloading doesn't affect the self_and_ancestors: m.reload assert_equal [m, e], m.self_and_ancestors end describe CuisineType do it 'finds self and p...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/namespace_type_test.rb
test/closure_tree/namespace_type_test.rb
# frozen_string_literal: true require 'test_helper' describe Namespace::Type do describe 'class injection' do it 'should build hierarchy classname correctly' do assert_equal 'Namespace::TypeHierarchy', Namespace::Type.hierarchy_class.to_s assert_equal 'Namespace::TypeHierarchy', Namespace::Type._ct....
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/label_order_value_test.rb
test/closure_tree/label_order_value_test.rb
# frozen_string_literal: true require 'test_helper' class LabelOrderValueTest < ActiveSupport::TestCase def setup Label.delete_all LabelHierarchy.delete_all end test 'should set order_value on roots for Label' do root = Label.create(name: 'root') assert_equal 0, root.order_value end test '...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/pool_test.rb
test/closure_tree/pool_test.rb
# frozen_string_literal: true require 'test_helper' describe 'Configuration' do it 'returns connection to the pool after has_closure_tree setup' do class TypeDuplicate < ActiveRecord::Base self.table_name = "namespace_type#{table_name_suffix}" has_closure_tree end refute ActiveRecord::Base....
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/multi_database_test.rb
test/closure_tree/multi_database_test.rb
# frozen_string_literal: true require 'test_helper' class MultiDatabaseTest < ActiveSupport::TestCase def setup super # Create memory tables - always recreate for clean state SqliteRecord.connection.create_table :memory_tags, force: true do |t| t.string :name t.integer :parent_id t.tim...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/parallel_test.rb
test/closure_tree/parallel_test.rb
# frozen_string_literal: true require 'test_helper' # We don't need to run the expensive parallel tests for every combination of prefix/suffix. # Those affect SQL generation, not parallelism. # SQLite doesn't support concurrency reliably, either. def run_parallel_tests? !sqlite? && ActiveRecord::Base.table_name...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/matcher_test.rb
test/closure_tree/matcher_test.rb
# frozen_string_literal: true require 'test_helper' require 'closure_tree/test/matcher' class MatcherTest < ActiveSupport::TestCase include ClosureTree::Test::Matcher setup do ENV['FLOCK_DIR'] = Dir.mktmpdir end teardown do FileUtils.remove_entry_secure ENV.fetch('FLOCK_DIR', nil) end test 'be_...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/test/closure_tree/support_test.rb
test/closure_tree/support_test.rb
# frozen_string_literal: true require 'test_helper' describe ClosureTree::Support do let(:sut) { Tag._ct } it 'passes through table names without prefix and suffix' do expected = 'some_random_table_name' assert_equal expected, sut.remove_prefix_and_suffix(expected) end it 'extracts through table nam...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree.rb
lib/closure_tree.rb
# frozen_string_literal: true require 'active_record' require 'zeitwerk' loader = Zeitwerk::Loader.for_gem loader.ignore("#{__dir__}/generators") loader.setup module ClosureTree def self.configure if block_given? # Create a temporary configuration object to capture deprecated settings config = Conf...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/generators/closure_tree/migration_generator.rb
lib/generators/closure_tree/migration_generator.rb
# frozen_string_literal: true require 'closure_tree/active_record_support' require 'forwardable' require 'rails/generators' require 'rails/generators/active_record' require 'rails/generators/named_base' module ClosureTree module Generators # :nodoc: class MigrationGenerator < Rails::Generators::NamedBase # :nod...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/support_attributes.rb
lib/closure_tree/support_attributes.rb
# frozen_string_literal: true require 'forwardable' require 'zlib' module ClosureTree module SupportAttributes extend Forwardable def_delegators :model_class, :connection, :transaction, :table_name, :base_class, :inheritance_column, :column_names def advisory_lock_name # Allow customization via o...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/arel_helpers.rb
lib/closure_tree/arel_helpers.rb
# frozen_string_literal: true module ClosureTree module ArelHelpers # Get model's arel table def model_table @model_table ||= model_class.arel_table end # Get hierarchy table from a model class # This method should be called from instance methods where hierarchy_class is available def ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/has_closure_tree.rb
lib/closure_tree/has_closure_tree.rb
# frozen_string_literal: true module ClosureTree module HasClosureTree def has_closure_tree(options = {}) options.assert_valid_keys( :parent_column_name, :dependent, :hierarchy_class_name, :hierarchy_table_name, :name_column, :order, :dont_order_roots...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/numeric_deterministic_ordering.rb
lib/closure_tree/numeric_deterministic_ordering.rb
# frozen_string_literal: true require 'active_support/concern' # This module is only included if the order column is an integer. module ClosureTree module NumericDeterministicOrdering extend ActiveSupport::Concern included do after_destroy :_ct_reorder_siblings end def _ct_reorder_prior_sibl...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/support_flags.rb
lib/closure_tree/support_flags.rb
# frozen_string_literal: true module ClosureTree module SupportFlags def order_option? order_by.present? end def order_is_numeric? options[:numeric_order] end def subclass? model_class != model_class.base_class end def has_inheritance_column?(hash = columns_hash) ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/version.rb
lib/closure_tree/version.rb
# frozen_string_literal: true module ClosureTree VERSION = Gem::Version.new('9.3.0') end
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/finders.rb
lib/closure_tree/finders.rb
# frozen_string_literal: true module ClosureTree module Finders extend ActiveSupport::Concern # Find a descendant node whose +ancestry_path+ will be ```self.ancestry_path + path``` def find_by_path(path, attributes = {}) return self if path.empty? self.class.find_by_path(path, attributes, i...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/active_record_support.rb
lib/closure_tree/active_record_support.rb
# frozen_string_literal: true module ClosureTree module ActiveRecordSupport delegate :quote, to: :connection def remove_prefix_and_suffix(table_name, model = ActiveRecord::Base) pre = model.table_name_prefix suff = model.table_name_suffix if table_name.start_with?(pre) && table_name.end_wi...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/has_closure_tree_root.rb
lib/closure_tree/has_closure_tree_root.rb
# frozen_string_literal: true module ClosureTree class MultipleRootError < StandardError; end class RootOrderingDisabledError < StandardError; end module HasClosureTreeRoot def has_closure_tree_root(assoc_name, options = {}) options[:class_name] ||= assoc_name.to_s.sub(/\Aroot_/, '').classify op...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/hash_tree_support.rb
lib/closure_tree/hash_tree_support.rb
# frozen_string_literal: true module ClosureTree module HashTreeSupport def default_tree_scope(scope, limit_depth = nil) # Deepest generation, within limit, for each descendant # NOTE: Postgres requires HAVING clauses to always contains aggregate functions (!!) # Get the hierarchy table for th...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/numeric_order_support.rb
lib/closure_tree/numeric_order_support.rb
# frozen_string_literal: true module ClosureTree module NumericOrderSupport def self.adapter_for_connection(connection) adapter_name = connection.adapter_name.downcase if adapter_name.include?('postgresql') || adapter_name.include?('postgis') ::ClosureTree::NumericOrderSupport::PostgreSQLAdap...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/digraphs.rb
lib/closure_tree/digraphs.rb
# frozen_string_literal: true module ClosureTree module Digraphs extend ActiveSupport::Concern def to_dot_digraph self.class.to_dot_digraph(self_and_descendants) end # override this method in your model class if you want a different digraph label. def to_digraph_label _ct.has_name? ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/hash_tree.rb
lib/closure_tree/hash_tree.rb
# frozen_string_literal: true module ClosureTree module HashTree extend ActiveSupport::Concern def hash_tree(options = {}) _ct.hash_tree(self_and_descendants, options[:limit_depth]) end class_methods do # There is no default depth limit. This might be crazy-big, depending # on you...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/configuration.rb
lib/closure_tree/configuration.rb
# frozen_string_literal: true module ClosureTree # Minimal configuration class to handle deprecated options class Configuration def database_less=(_value) ActiveSupport::Deprecation.new.warn( 'ClosureTree.configure { |config| config.database_less = true } is deprecated ' \ 'and will be re...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/hierarchy_maintenance.rb
lib/closure_tree/hierarchy_maintenance.rb
# frozen_string_literal: true require 'active_support/concern' module ClosureTree module HierarchyMaintenance extend ActiveSupport::Concern included do validate :_ct_validate before_save :_ct_before_save after_save :_ct_after_save before_destroy :_ct_before_destroy end def ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/deterministic_ordering.rb
lib/closure_tree/deterministic_ordering.rb
# frozen_string_literal: true module ClosureTree module DeterministicOrdering def order_value read_attribute(_ct.order_column_sym) end def update_order_value(order_value) update_column(_ct.order_column_sym, order_value) end def order_value=(new_order_value) write_attribute(_ct...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/association_setup.rb
lib/closure_tree/association_setup.rb
# frozen_string_literal: true require 'active_support/concern' module ClosureTree # This concern sets up the ActiveRecord associations after all other modules are included. # It must be included last to ensure that HierarchyMaintenance callbacks are already set up. module AssociationSetup extend ActiveSuppo...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/model.rb
lib/closure_tree/model.rb
# frozen_string_literal: true require 'active_support/concern' module ClosureTree module Model extend ActiveSupport::Concern # Delegate to the Support instance on the class: def _ct self.class._ct end # Returns true if this node has no parents. def root? # Accessing the parent ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/support.rb
lib/closure_tree/support.rb
# frozen_string_literal: true # This class and mixins are an effort to reduce the namespace pollution to models that act_as_tree. module ClosureTree class Support include ClosureTree::SupportFlags include ClosureTree::SupportAttributes include ClosureTree::ActiveRecordSupport include ClosureTree::Has...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
ClosureTree/closure_tree
https://github.com/ClosureTree/closure_tree/blob/cde4d292236b4267ac4c0be2e2b21092a8b6298c/lib/closure_tree/test/matcher.rb
lib/closure_tree/test/matcher.rb
# frozen_string_literal: true require 'closure_tree' module ClosureTree module Test module Matcher def be_a_closure_tree ClosureTree.new end class ClosureTree def matches?(subject) @subject = subject.is_a?(Class) ? subject : subject.class # OPTIMIZE ...
ruby
MIT
cde4d292236b4267ac4c0be2e2b21092a8b6298c
2026-01-04T15:59:48.713684Z
false
brotandgames/ciao
https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/jobs/application_job.rb
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
63a79aa41caa9a1d149e07623448fcd679cfafca
2026-01-04T15:59:50.025269Z
false
brotandgames/ciao
https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/helpers/application_helper.rb
app/helpers/application_helper.rb
# frozen_string_literal: true module ApplicationHelper end
ruby
MIT
63a79aa41caa9a1d149e07623448fcd679cfafca
2026-01-04T15:59:50.025269Z
false
brotandgames/ciao
https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/helpers/checks_helper.rb
app/helpers/checks_helper.rb
# frozen_string_literal: true module ChecksHelper # Converts the status to the corresponding CSS class # to control HTML element classes based on status # @param status [String] this is either the HTTP status code or an error, `1XX..5XX` or `e` # @return [String] the CSS class for the corresponding HTTP status...
ruby
MIT
63a79aa41caa9a1d149e07623448fcd679cfafca
2026-01-04T15:59:50.025269Z
false
brotandgames/ciao
https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/validators/cron_validator.rb
app/validators/cron_validator.rb
# frozen_string_literal: true class CronValidator < ActiveModel::EachValidator def self.compliant?(value) cron = ::Fugit::Cron.parse(value) cron.present? rescue => e Rails.logger.info "CronValidator Exception: #{e}" false end def validate_each(record, attribute, value) return if value.pres...
ruby
MIT
63a79aa41caa9a1d149e07623448fcd679cfafca
2026-01-04T15:59:50.025269Z
false
brotandgames/ciao
https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/validators/http_url_validator.rb
app/validators/http_url_validator.rb
# frozen_string_literal: true class HttpUrlValidator < ActiveModel::EachValidator def self.compliant?(value) escaped_address = URI::DEFAULT_PARSER.escape(value) uri = URI.parse(escaped_address) uri.is_a?(URI::HTTP) && !uri.host.nil? rescue URI::InvalidURIError false end def validate_each(recor...
ruby
MIT
63a79aa41caa9a1d149e07623448fcd679cfafca
2026-01-04T15:59:50.025269Z
false
brotandgames/ciao
https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/controllers/checks_controller.rb
app/controllers/checks_controller.rb
# frozen_string_literal: true class ChecksController < ApplicationController before_action :set_check, only: %i[show edit update destroy] # GET /checks # GET /checks.json def index @checks = Check.all end # GET /checks/1 # GET /checks/1.json def show end # GET /checks/new def new @chec...
ruby
MIT
63a79aa41caa9a1d149e07623448fcd679cfafca
2026-01-04T15:59:50.025269Z
false
brotandgames/ciao
https://github.com/brotandgames/ciao/blob/63a79aa41caa9a1d149e07623448fcd679cfafca/app/controllers/application_controller.rb
app/controllers/application_controller.rb
# frozen_string_literal: true class ApplicationController < ActionController::Base before_action :authenticate protect_from_forgery unless: -> { request.format.json? } def authenticate basic_auth_username = ENV.fetch("BASIC_AUTH_USERNAME", "") basic_auth_password = ENV.fetch("BASIC_AUTH_PASSWORD", "") ...
ruby
MIT
63a79aa41caa9a1d149e07623448fcd679cfafca
2026-01-04T15:59:50.025269Z
false