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
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/samples/Ruby/foo.rb
samples/Ruby/foo.rb
module Foo end
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/samples/Ruby/inflector.rb
samples/Ruby/inflector.rb
# encoding: utf-8 require 'active_support/inflector/inflections' module ActiveSupport # The Inflector transforms words from singular to plural, class names to table names, modularized class names to ones without, # and class names to foreign keys. The default inflections for pluralization, singularization, and un...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/samples/Ruby/racc.rb
samples/Ruby/racc.rb
# # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.4.7 # from Racc grammer file "". # require 'racc/parser.rb' module RJSON class Parser < Racc::Parser require 'rjson/handler' attr_reader :handler def initialize tokenizer, handler = Handler.new @tokenizer = tokenizer @handler ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/samples/Ruby/jekyll.rb
samples/Ruby/jekyll.rb
$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed # Require all of the Ruby files in the given directory. # # path - The String relative path from here to the directory. # # Returns nothing. def require_all(path) glob = File.join(File.dirname(__FILE__), path, '*.rb') Dir[glob].each do |f...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/samples/Ruby/formula.rb
samples/Ruby/formula.rb
require 'download_strategy' require 'dependencies' require 'formula_support' require 'hardware' require 'bottles' require 'extend/fileutils' require 'patches' require 'compilers' # Derive and define at least @url, see Library/Formula for examples class Formula include FileUtils attr_reader :name, :path, :url, :ve...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/samples/Ruby/grit.rb
samples/Ruby/grit.rb
module Grit end
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_repository.rb
test/test_repository.rb
require_relative "./helper" class TestRuggedRepository < Minitest::Test def master_oid '7dbcffcf982e766fc711e633322de848f2b60ba5' end def linguist_repo(oid = master_oid) Linguist::Repository.new(source_repository, oid) end def source_repository @rugged ||= Rugged::Repository.new(File.expand_pat...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_samples.rb
test/test_samples.rb
require_relative "./helper" require "tempfile" class TestSamples < Minitest::Test include Linguist def test_up_to_date assert serialized = Samples.cache assert latest = Samples.data # Just warn, it shouldn't scare people off by breaking the build. if serialized['sha256'] != latest['sha256'] ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_tokenizer.rb
test/test_tokenizer.rb
require_relative "./helper" class TestTokenizer < Minitest::Test include Linguist def tokenize(data) data = File.read(File.join(samples_path, data.to_s)) if data.is_a?(Symbol) Tokenizer.tokenize(data) end def test_skip_string_literals assert_equal %w(print), tokenize('print ""') assert_equal ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_pedantic.rb
test/test_pedantic.rb
require_relative "./helper" class TestPedantic < Minitest::Test filename = File.expand_path("../../lib/linguist/languages.yml", __FILE__) LANGUAGES = YAML.load(File.read(filename)) GRAMMARS = YAML.load(File.read(File.expand_path("../../grammars.yml", __FILE__))) GENERICS = YAML.load_file(File.expand_path("../....
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_blob.rb
test/test_blob.rb
require_relative "./helper" class TestBlob < Minitest::Test include Linguist def script_blob(name) blob = sample_blob_memory(name) blob.instance_variable_set(:@name, 'script') blob end def test_name assert_equal "foo.rb", sample_blob_memory("Ruby/foo.rb").name end def test_mime_type ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_heuristics.rb
test/test_heuristics.rb
require_relative "./helper" class TestHeuristics < Minitest::Test include Linguist def fixture(name) File.read(File.join(samples_path, name)) end def file_blob(name, alt_name=nil) path = File.exist?(name) ? name : File.join(samples_path, name) blob = FileBlob.new(path) if !alt_name.nil? ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
true
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_strategies.rb
test/test_strategies.rb
require_relative "./helper" class TestStrategies < Minitest::Test include Linguist def assert_modeline(language, blob) if language.nil? assert_nil Linguist::Strategy::Modeline.call(blob).first else assert_equal language, Linguist::Strategy::Modeline.call(blob).first end end def assert...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_classifier.rb
test/test_classifier.rb
require_relative "./helper" class TestClassifier < Minitest::Test include Linguist def fixture(name) File.read(File.join(samples_path, name)) end def test_classify db = {} Classifier.train! db, "Ruby", fixture("Ruby/foo.rb") Classifier.train! db, "Objective-C", fixture("Objective-C/Foo.h") ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_instrumentation.rb
test/test_instrumentation.rb
require_relative "./helper" class TestInstrumentation < Minitest::Test include Linguist class LocalInstrumenter Event = Struct.new(:name, :args) attr_reader :events def initialize @events = [] end def instrument(name, *args) @events << Event.new(name, args) yield if block_...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_basic_instrumenter.rb
test/test_basic_instrumenter.rb
require_relative "./helper" class TestBasicInstrumenter < Minitest::Test include Linguist def setup @instrumenter = Linguist::BasicInstrumenter.new Linguist.instrumenter = @instrumenter end def teardown Linguist.instrumenter = nil end def test_tracks_extension_strategy # Ruby file detect...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/helper.rb
test/helper.rb
require "bundler/setup" require "minitest/autorun" require "mocha/minitest" require "linguist" require "linguist/blob" require "licensee" require "set" def fixtures_path File.expand_path("../fixtures", __FILE__) end def fixture_blob(name) filepath = (name =~ /^\//)? name : File.join(fixtures_path, name) Linguis...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_language.rb
test/test_language.rb
require_relative "./helper" class TestLanguage < Minitest::Test include Linguist def test_find_by_alias assert_equal Language['ASP.NET'], Language.find_by_alias('aspx') assert_equal Language['ASP.NET'], Language.find_by_alias('aspx-vb') assert_equal Language['ActionScript'], Language.find_by_alias('as...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_file_blob.rb
test/test_file_blob.rb
require_relative "./helper" class TestFileBlob < Minitest::Test include Linguist def silence_warnings original_verbosity = $VERBOSE $VERBOSE = nil yield ensure $VERBOSE = original_verbosity end def script_blob(name) blob = sample_blob(name) blob.instance_variable_set(:@name, 'script...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_grammars.rb
test/test_grammars.rb
require_relative "./helper" class TestGrammars < Minitest::Test ROOT = File.expand_path("../..", __FILE__) def setup @grammars = YAML.load(File.read(File.join(ROOT, "grammars.yml"))) end def test_no_duplicate_scopes scopes = @grammars.values.flatten duplicates = scopes.group_by { |s| s }.select {...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_generated.rb
test/test_generated.rb
require_relative "./helper" class TestGenerated < Minitest::Test include Linguist class DataLoadedError < StandardError; end def error_message(blob, negate = false) if negate "#{blob} was incorrectly recognised as a generated file" else "#{blob} was not recognised as a generated file" e...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/test_sha256.rb
test/test_sha256.rb
require_relative "./helper" class TestSHA256 < Minitest::Test include Linguist def test_hexdigest_string assert_equal "15020d93a6f635366cb20229cb3931c3651992dc6df85cddecc743fa11e48a66", SHA256.hexdigest("foo") assert_equal "3da77c2b08c7d29fe3d936b7918039941c0881065dde07d0af9d280d2d475d00", SHA256.hexdiges...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/test/fixtures/Ruby/foo.rb
test/fixtures/Ruby/foo.rb
# This file is used to test the Linguist language detection capabilities. # It should be detected as Ruby based on its extension and content. # The file is intentionally simple to ensure it does not contain complex logic. # You can add more Ruby code here if needed for further testing. # The purpose of this file is to ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/ext/linguist/extconf.rb
ext/linguist/extconf.rb
require 'mkmf' dir_config('linguist') create_makefile('linguist/linguist')
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist.rb
lib/linguist.rb
require 'linguist/blob_helper' require 'linguist/generated' require 'linguist/grammars' require 'linguist/heuristics' require 'linguist/language' require 'linguist/repository' require 'linguist/samples' require 'linguist/shebang' require 'linguist/version' require 'linguist/strategy/manpage' require 'linguist/strategy/...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/language.rb
lib/linguist/language.rb
require 'cgi' require 'yaml' begin require 'yajl' rescue LoadError require 'json' end require 'linguist/classifier' require 'linguist/heuristics' require 'linguist/samples' require 'linguist/file_blob' require 'linguist/blob_helper' require 'linguist/strategy/filename' require 'linguist/strategy/extension' require...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/samples.rb
lib/linguist/samples.rb
begin require 'yajl' rescue LoadError require 'json' end require 'linguist/sha256' require 'linguist/classifier' require 'linguist/shebang' module Linguist # Model for accessing classifier training data. module Samples # Path to samples root directory ROOT = File.expand_path("../../../samples", __FILE...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/repository.rb
lib/linguist/repository.rb
require 'linguist/lazy_blob' require 'linguist/source/repository' require 'linguist/source/rugged' module Linguist # A Repository is an abstraction of a Grit::Repo or a basic file # system tree. It holds a list of paths pointing to Blobish objects. # # Its primary purpose is for gathering language statistics a...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/version.rb
lib/linguist/version.rb
module Linguist VERSION = File.read(File.expand_path("../VERSION", __FILE__)).strip end
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/lazy_blob.rb
lib/linguist/lazy_blob.rb
require 'linguist/blob_helper' require 'linguist/language' require 'linguist/source/repository' require 'linguist/source/rugged' module Linguist class LazyBlob GIT_ATTR = ['linguist-documentation', 'linguist-language', 'linguist-vendored', 'linguist-generated', ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/shebang.rb
lib/linguist/shebang.rb
# frozen_string_literal: true module Linguist class Shebang # Public: Use shebang to detect language of the blob. # # blob - An object that quacks like a blob. # candidates - A list of candidate languages. # # Examples # # Shebang.call(FileBlob.new("path/to/fil...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/tokenizer.rb
lib/linguist/tokenizer.rb
require 'strscan' require 'linguist/linguist' module Linguist # Generic programming language tokenizer. # # Tokens are designed for use in the language bayes classifier. # It strips any data strings or comments and preserves significant # language symbols. class Tokenizer # Public: Extract tokens from ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/blob_helper.rb
lib/linguist/blob_helper.rb
require 'linguist/generated' require 'cgi' require 'charlock_holmes' require 'mini_mime' require 'yaml' module Linguist # DEPRECATED Avoid mixing into Blob classes. Prefer functional interfaces # like `Linguist.detect` over `Blob#language`. Functions are much easier to # cache and compose. # # Avoid adding a...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/file_blob.rb
lib/linguist/file_blob.rb
require 'linguist/blob_helper' require 'linguist/blob' module Linguist # A FileBlob is a wrapper around a File object to make it quack # like a Grit::Blob. It provides the basic interface: `name`, # `data`, `path` and `size`. class FileBlob < Blob include BlobHelper # Public: Initialize a new FileBlob...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/classifier.rb
lib/linguist/classifier.rb
require 'linguist/tokenizer' require 'set' module Linguist # Language content classifier. class Classifier # Maximum number of bytes to consider for classification. # This is only used at evaluation time. During training, full content of # samples is used. CLASSIFIER_CONSIDER_BYTES = 50 * 1024 ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/grammars.rb
lib/linguist/grammars.rb
module Linguist module Grammars # Get the path to the directory containing the language grammar JSON files. # # Returns a String. def self.path File.expand_path("../../../grammars", __FILE__) end end end
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/instrumenter.rb
lib/linguist/instrumenter.rb
module Linguist class BasicInstrumenter attr_reader :detected_info def initialize @detected_info = {} end def instrument(name, payload = {}) if name == "linguist.detected" && payload[:blob] @detected_info[payload[:blob].name] = { strategy: payload[:strategy].name.split(...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/blob.rb
lib/linguist/blob.rb
require 'linguist/blob_helper' module Linguist # A Blob is a wrapper around the content of a file to make it quack # like a Grit::Blob. It provides the basic interface: `name`, # `data`, `path` and `size`. class Blob include BlobHelper # Public: Initialize a new Blob. # # path - A path Stri...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/heuristics.rb
lib/linguist/heuristics.rb
require 'yaml' module Linguist # A collection of simple heuristics that can be used to better analyze languages. class Heuristics HEURISTICS_CONSIDER_BYTES = 50 * 1024 # Public: Use heuristics to detect language of the blob. # # blob - An object that quacks like a blob. # possibl...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/generated.rb
lib/linguist/generated.rb
module Linguist class Generated # Public: Is the blob a generated file? # # name - String filename # data - String blob data. A block also may be passed in for lazy # loading. This behavior is deprecated and you should always # pass in a String. # # Return true or false ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/sha256.rb
lib/linguist/sha256.rb
require 'digest/sha2' module Linguist module SHA256 # Public: Create deep nested digest of value object. # # Useful for object comparison. # # obj - Object to digest. # # Returns String hex digest def self.hexdigest(obj) digest = Digest::SHA256.new case obj when Str...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/source/repository.rb
lib/linguist/source/repository.rb
module Linguist module Source # Repository is an interface for providing direct access to functionality in # a repository of files whose contents can be scanned for language # information. class Repository # Public: get the number of entries in the root tree of the given commit, # with an ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/source/diff.rb
lib/linguist/source/diff.rb
require 'linguist/generated' require 'cgi' require 'charlock_holmes' require 'mini_mime' require 'yaml' module Linguist module Source # Diff is an interface representing a diff between two trees. It is composed # of a collection of iterable deltas between before/after states of files. class Diff # ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/source/rugged.rb
lib/linguist/source/rugged.rb
require 'rugged' require 'linguist/source/diff' module Linguist module Source # RuggedRepository is an implementation of the Source::Repository abstract # class. It represents a Git repository that is accessed using the libgit2 # wrapper Rugged. class RuggedRepository < Linguist::Source::Repository ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/strategy/xml.rb
lib/linguist/strategy/xml.rb
module Linguist module Strategy # Detects XML files based on root tag. class XML # Scope of the search for the root tag # Number of lines to check at the beginning of the file SEARCH_SCOPE = 2 # Public: Use the root tag to detect the XML blobs, only if no other # candidates were...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/strategy/modeline.rb
lib/linguist/strategy/modeline.rb
module Linguist module Strategy class Modeline EMACS_MODELINE = %r[ (?-m) # Opening delimiter -\*- (?: # Short form: `-*- ruby -*-` [ \t]* (?= [^:;\s]+ # Name of mode [ \t]* # Optional whitespace -\*- ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/strategy/manpage.rb
lib/linguist/strategy/manpage.rb
module Linguist module Strategy # Detects man pages based on numeric file extensions with group suffixes. class Manpage # Public: RegExp for matching conventional manpage extensions # # This is the same expression as that used by `github/markup` MANPAGE_EXTS = /\.(?:[1-9](?![0-9])[a-z...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/strategy/filename.rb
lib/linguist/strategy/filename.rb
module Linguist module Strategy # Detects language based on filename class Filename # Public: Use the filename to detect the blob's language. # # blob - An object that quacks like a blob. # candidates - A list of candidate languages. # # Examples ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
github-linguist/linguist
https://github.com/github-linguist/linguist/blob/a7e40d31e271f6747fa1234df37b5fff3e6e2406/lib/linguist/strategy/extension.rb
lib/linguist/strategy/extension.rb
require 'yaml' module Linguist module Strategy # Detects language based on extension class Extension # Public: Use the file extension to detect the blob's language. # # blob - An object that quacks like a blob. # candidates - A list of candidate languages. ...
ruby
MIT
a7e40d31e271f6747fa1234df37b5fff3e6e2406
2026-01-04T15:37:32.851738Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/spec/clear_spec.rb
spec/clear_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Clear", type: :feature do it "clears all messages" do # Delivering three emails .. deliver_example("plainmail") deliver_example("plainmail") deliver_example("plainmail") # .. should display three emails expect(page).to have...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/spec/quit_spec.rb
spec/quit_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe "Quit", type: :feature do it "quits cleanly via the Quit button" do # Quitting and cancelling .. dismiss_confirm do click_on "Quit" end # .. should not exit the process expect { Process.kill(0, @pid) }.not_to raise_error ...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/spec/delivery_spec.rb
spec/delivery_spec.rb
# frozen_string_literal: true require "spec_helper" RSpec.describe MailCatcher, type: :feature do def messages_element page.find("#messages") end def message_row_element messages_element.find(:xpath, ".//table/tbody/tr[1]") end def message_from_element message_row_element.find(:xpath, ".//td[1...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/spec/command_spec.rb
spec/command_spec.rb
require "spec_helper" RSpec.describe "mailcatcher command" do context "--version" do it "shows a version then exits" do expect { system %(mailcatcher --version) } .to output(a_string_including("MailCatcher v#{MailCatcher::VERSION}")) .to_stdout_from_any_process end end context "--h...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true ENV["MAILCATCHER_ENV"] ||= "test" require "capybara/rspec" require "capybara-screenshot/rspec" require "selenium/webdriver" require "net/smtp" require "socket" require "mail_catcher" DEFAULT_FROM = "from@example.com" DEFAULT_TO = "to@example.com" LOCALHOST = "127.0.0.1" SMTP_PORT = 2...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/lib/mailcatcher.rb
lib/mailcatcher.rb
# frozen_string_literal: true require "mail_catcher" Mailcatcher = MailCatcher
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/lib/mail_catcher.rb
lib/mail_catcher.rb
# frozen_string_literal: true require "open3" require "optparse" require "rbconfig" require "eventmachine" require "thin" module EventMachine # Monkey patch fix for 10deb4 # See https://github.com/eventmachine/eventmachine/issues/569 def self.reactor_running? (@reactor_running || false) end end require ...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/lib/mail_catcher/version.rb
lib/mail_catcher/version.rb
# frozen_string_literal: true module MailCatcher VERSION = "0.10.0" end
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/lib/mail_catcher/smtp.rb
lib/mail_catcher/smtp.rb
# frozen_string_literal: true require "eventmachine" require "mail_catcher/mail" class MailCatcher::Smtp < EventMachine::Protocols::SmtpServer # We override EM's mail from processing to allow multiple mail-from commands # per [RFC 2821](https://tools.ietf.org/html/rfc2821#section-4.1.1.2) def process_mail_from...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/lib/mail_catcher/web.rb
lib/mail_catcher/web.rb
# frozen_string_literal: true require "rack/builder" require "mail_catcher/web/application" module MailCatcher module Web extend self def app @@app ||= Rack::Builder.new do map(MailCatcher.options[:http_path]) do if MailCatcher.development? require "mail_catcher/web/assets" ...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/lib/mail_catcher/mail.rb
lib/mail_catcher/mail.rb
# frozen_string_literal: true require "eventmachine" require "json" require "mail" require "sqlite3" module MailCatcher::Mail extend self def db @__db ||= begin SQLite3::Database.new(":memory:", :type_translation => true).tap do |db| db.execute(<<-SQL) CREATE TABLE message ( ...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/lib/mail_catcher/bus.rb
lib/mail_catcher/bus.rb
# frozen_string_literal: true require "eventmachine" module MailCatcher Bus = EventMachine::Channel.new end
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/lib/mail_catcher/web/application.rb
lib/mail_catcher/web/application.rb
# frozen_string_literal: true require "pathname" require "net/http" require "uri" require "faye/websocket" require "sinatra" require "mail_catcher/bus" require "mail_catcher/mail" Faye::WebSocket.load_adapter("thin") # Faye's adapter isn't smart enough to close websockets when thin is stopped, # so we teach it to ...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
sj26/mailcatcher
https://github.com/sj26/mailcatcher/blob/fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843/lib/mail_catcher/web/assets.rb
lib/mail_catcher/web/assets.rb
# frozen_string_literal: true require "sprockets" require "sprockets-sass" require "compass" module MailCatcher module Web Assets = Sprockets::Environment.new(File.expand_path("#{__FILE__}/../../../..")).tap do |sprockets| Dir["#{sprockets.root}/{,vendor}/assets/*"].each do |path| sprockets.append...
ruby
MIT
fbe811a53aeabe75b6e728b87f7f4c8fbf4b4843
2026-01-04T15:40:11.381229Z
false
kkuchta/css-only-chat
https://github.com/kkuchta/css-only-chat/blob/b5a2e3853803d0fb9b3f057b6f989a73e3f0e1b1/server.rb
server.rb
require 'redis' require 'json' require 'securerandom' # Since some requests (intentionally) never complete, ctrl-c won't kill this # server. Let's make sure it does. Signal.trap(2) { exit } # Misc redis keys NEW_MESSAGE_CHANNEL = 'new_message_channel'.freeze UPDATED_CLIENT_CHANNEL = 'updated_client_channel'.freeze M...
ruby
MIT
b5a2e3853803d0fb9b3f057b6f989a73e3f0e1b1
2026-01-04T15:40:18.447348Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/benchmark/index.rb
benchmark/index.rb
require "bundler/setup" Bundler.require(:default) require "active_record" require "active_job" require "benchmark" require "active_support/notifications" ActiveSupport::Notifications.subscribe "request.searchkick" do |*args| event = ActiveSupport::Notifications::Event.new(*args) # puts "Import: #{event.duration.ro...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/benchmark/search.rb
benchmark/search.rb
require "bundler/setup" Bundler.require(:default) require "active_record" require "benchmark/ips" ActiveRecord.default_timezone = :utc ActiveRecord::Base.time_zone_aware_attributes = true ActiveRecord::Base.establish_connection adapter: "sqlite3", database: "/tmp/searchkick" class Product < ActiveRecord::Base searc...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/geo_shape_test.rb
test/geo_shape_test.rb
require_relative "test_helper" class GeoShapeTest < Minitest::Test def setup setup_region store [ { name: "Region A", text: "The witch had a cat", territory: { type: "polygon", coordinates: [[[30, 40], [35, 45], [40, 40], [40, 30], [30, 30], [30, 40]]] ...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/pagination_test.rb
test/pagination_test.rb
require_relative "test_helper" class PaginationTest < Minitest::Test def test_limit store_names ["Product A", "Product B", "Product C", "Product D"] assert_order "product", ["Product A", "Product B"], order: {name: :asc}, limit: 2 assert_order_relation ["Product A", "Product B"], Product.search("product"...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/log_subscriber_test.rb
test/log_subscriber_test.rb
require_relative "test_helper" class LogSubscriberTest < Minitest::Test def test_create output = capture_logs do Product.create!(name: "Product A") end assert_match "Product Store", output end def test_update product = Product.create!(name: "Product A") output = capture_logs do p...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/where_test.rb
test/where_test.rb
require_relative "test_helper" class WhereTest < Minitest::Test def test_where now = Time.now store [ {name: "Product A", store_id: 1, in_stock: true, backordered: true, created_at: now, orders_count: 4, user_ids: [1, 2, 3]}, {name: "Product B", store_id: 2, in_stock: true, backordered: false, cr...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/unscope_test.rb
test/unscope_test.rb
require_relative "test_helper" class UnscopeTest < Minitest::Test def setup @@once ||= Artist.reindex Artist.unscoped.destroy_all end def test_reindex create_records Artist.reindex assert_search "*", ["Test", "Test 2"] assert_search "*", ["Test", "Test 2"], {load: false} end def t...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/relation_test.rb
test/relation_test.rb
require_relative "test_helper" class RelationTest < Minitest::Test def test_loaded Product.searchkick_index.refresh products = Product.search("*") refute products.loaded? assert_equal 0, products.count assert products.loaded? refute products.clone.loaded? refute products.dup.loaded? r...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/reindex_test.rb
test/reindex_test.rb
require_relative "test_helper" class ReindexTest < Minitest::Test def test_record_inline store_names ["Product A", "Product B"], reindex: false product = Product.find_by!(name: "Product A") assert_equal true, product.reindex(refresh: true) assert_search "product", ["Product A"] end def test_rec...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/highlight_test.rb
test/highlight_test.rb
require_relative "test_helper" class HighlightTest < Minitest::Test def test_basic store_names ["Two Door Cinema Club"] assert_equal "Two Door <em>Cinema</em> Club", Product.search("cinema", highlight: true).highlights.first[:name] end def test_with_highlights store_names ["Two Door Cinema Club"] ...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/partial_match_test.rb
test/partial_match_test.rb
require_relative "test_helper" class PartialMatchTest < Minitest::Test def test_autocomplete store_names ["Hummus"] assert_search "hum", ["Hummus"], match: :text_start end def test_autocomplete_two_words store_names ["Organic Hummus"] assert_search "hum", [], match: :text_start end def test...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/select_test.rb
test/select_test.rb
require_relative "test_helper" class SelectTest < Minitest::Test def test_basic store [{name: "Product A", store_id: 1}] result = Product.search("product", load: false, select: [:name, :store_id]).first assert_equal %w(id name store_id), result.to_h.keys.reject { |k| k.start_with?("_") }.sort assert_...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/results_test.rb
test/results_test.rb
require_relative "test_helper" class ResultsTest < Minitest::Test def test_array_methods store_names ["Product A", "Product B"] products = Product.search("product") assert_equal 2, products.count assert_equal 2, products.size assert_equal 2, products.length assert products.any? refute pro...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/search_test.rb
test/search_test.rb
require_relative "test_helper" class SearchTest < Minitest::Test def test_search_relation error = assert_raises(Searchkick::Error) do Product.all.search("*") end assert_equal "search must be called on model, not relation", error.message end def test_unscoped if mongoid? Product.unsco...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/aggs_test.rb
test/aggs_test.rb
require_relative "test_helper" class AggsTest < Minitest::Test def setup super store [ {name: "Product Show", latitude: 37.7833, longitude: 12.4167, store_id: 1, in_stock: true, color: "blue", price: 21, created_at: 2.days.ago}, {name: "Product Hide", latitude: 29.4167, longitude: -98.5000, store...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/hybrid_test.rb
test/hybrid_test.rb
require_relative "test_helper" class HybridTest < Minitest::Test def setup skip unless Searchkick.knn_support? super end def test_search error = assert_raises(ArgumentError) do Product.search("product", knn: {field: :embedding, vector: [1, 2, 3]}) end assert_equal "Use Searchkick.multi...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/inheritance_test.rb
test/inheritance_test.rb
require_relative "test_helper" class InheritanceTest < Minitest::Test def setup super setup_animal end def test_child_reindex store_names ["Max"], Cat assert Dog.reindex assert_equal 1, Animal.search("*").size end def test_child_index_name assert_equal "animals_test#{ENV["TEST_ENV_N...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/similar_test.rb
test/similar_test.rb
require_relative "test_helper" class SimilarTest < Minitest::Test def test_similar store_names ["Annie's Naturals Organic Shiitake & Sesame Dressing"] assert_search "Annie's Naturals Shiitake & Sesame Vinaigrette", ["Annie's Naturals Organic Shiitake & Sesame Dressing"], similar: true, fields: [:name] end ...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/index_test.rb
test/index_test.rb
require_relative "test_helper" class IndexTest < Minitest::Test def setup super setup_region end def test_tokens assert_equal ["dollar", "dollartre", "tree"], Product.searchkick_index.tokens("Dollar Tree", analyzer: "searchkick_index") end def test_tokens_analyzer assert_equal ["dollar", "t...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/knn_test.rb
test/knn_test.rb
require_relative "test_helper" class KnnTest < Minitest::Test def setup skip unless Searchkick.knn_support? super # prevent null_pointer_exception with OpenSearch 3 Product.reindex if Searchkick.opensearch? && !Searchkick.server_below?("3.0.0") end def test_basic store [{name: "A", embeddin...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/load_test.rb
test/load_test.rb
require_relative "test_helper" class LoadTest < Minitest::Test def test_default store_names ["Product A"] product = Product.search("product").first assert_kind_of Product, product if mongoid? assert_match "#<Product _id: ", product.inspect else assert_match "#<Product id: ", product.i...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/boost_test.rb
test/boost_test.rb
require_relative "test_helper" class BoostTest < Minitest::Test # global boost def test_boost store [ {name: "Tomato A"}, {name: "Tomato B", orders_count: 10}, {name: "Tomato C", orders_count: 100} ] assert_order "tomato", ["Tomato C", "Tomato B", "Tomato A"], boost: "orders_count" ...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/synonyms_test.rb
test/synonyms_test.rb
require_relative "test_helper" class SynonymsTest < Minitest::Test def test_bleach store_names ["Clorox Bleach", "Kroger Bleach"] assert_search "clorox", ["Clorox Bleach", "Kroger Bleach"] end def test_burger_buns store_names ["Hamburger Buns"] assert_search "burger buns", ["Hamburger Buns"] e...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/routing_test.rb
test/routing_test.rb
require_relative "test_helper" class RoutingTest < Minitest::Test def test_query query = Store.search("Dollar Tree", routing: "Dollar Tree") assert_equal query.params[:routing], "Dollar Tree" end def test_mappings mappings = Store.searchkick_index.index_options[:mappings] assert_equal mappings[:...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/test_helper.rb
test/test_helper.rb
require "bundler/setup" Bundler.require(:default) require "minitest/autorun" require "active_support/notifications" ENV["RACK_ENV"] = "test" # for reloadable synonyms if ENV["CI"] ENV["ES_PATH"] ||= File.join(ENV["HOME"], Searchkick.opensearch? ? "opensearch" : "elasticsearch", Searchkick.server_version) end $logg...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/reindex_v2_job_test.rb
test/reindex_v2_job_test.rb
require_relative "test_helper" class ReindexV2JobTest < Minitest::Test def test_create product = Searchkick.callbacks(false) { Product.create!(name: "Boom") } Product.searchkick_index.refresh assert_search "*", [] Searchkick::ReindexV2Job.perform_now("Product", product.id.to_s) Product.searchkick...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/default_scope_test.rb
test/default_scope_test.rb
require_relative "test_helper" class DefaultScopeTest < Minitest::Test def setup Band.destroy_all end def test_reindex store [ {name: "Test", active: true}, {name: "Test 2", active: false} ], reindex: false Band.reindex assert_search "*", ["Test"], {load: false} end def tes...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/index_options_test.rb
test/index_options_test.rb
require_relative "test_helper" class IndexOptionsTest < Minitest::Test def setup Song.destroy_all end def test_case_sensitive with_options({case_sensitive: true}) do store_names ["Test", "test"] assert_search "test", ["test"], {misspellings: false} end end def test_no_stemming w...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/multi_tenancy_test.rb
test/multi_tenancy_test.rb
require_relative "test_helper" class MultiTenancyTest < Minitest::Test def setup skip unless defined?(Apartment) end def test_basic Apartment::Tenant.switch!("tenant1") store_names ["Product A"] Apartment::Tenant.switch!("tenant2") store_names ["Product B"] Apartment::Tenant.switch!("ten...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/should_index_test.rb
test/should_index_test.rb
require_relative "test_helper" class ShouldIndexTest < Minitest::Test def test_basic store_names ["INDEX", "DO NOT INDEX"] assert_search "index", ["INDEX"] end def test_default_true assert Store.new.should_index? end def test_change_to_true store_names ["DO NOT INDEX"] assert_search "in...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/query_test.rb
test/query_test.rb
require_relative "test_helper" class QueryTest < Minitest::Test def test_basic store_names ["Milk", "Apple"] query = Product.search("milk", body: {query: {match_all: {}}}) assert_equal ["Apple", "Milk"], query.map(&:name).sort end def test_with_uneffective_min_score store_names ["Milk", "Milk2"]...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/suggest_test.rb
test/suggest_test.rb
require_relative "test_helper" class SuggestTest < Minitest::Test def setup super Product.reindex end def test_basic store_names ["Great White Shark", "Hammerhead Shark", "Tiger Shark"] assert_suggest "How Big is a Tigre Shar", "how big is a tiger shark", fields: [:name] end def test_perfec...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/search_synonyms_test.rb
test/search_synonyms_test.rb
require_relative "test_helper" class SearchSynonymsTest < Minitest::Test def setup super setup_speaker end def test_bleach store_names ["Clorox Bleach", "Kroger Bleach"] assert_search "clorox", ["Clorox Bleach", "Kroger Bleach"] end def test_burger_buns store_names ["Hamburger Buns"] ...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/conversions_test.rb
test/conversions_test.rb
require_relative "test_helper" class ConversionsTest < Minitest::Test def setup super setup_speaker end def test_v1 store [ {name: "Tomato A", conversions: {"tomato" => 1}}, {name: "Tomato B", conversions: {"tomato" => 2}}, {name: "Tomato C", conversions: {"tomato" => 3}} ] ...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/match_test.rb
test/match_test.rb
require_relative "test_helper" class MatchTest < Minitest::Test # exact def test_match store_names ["Whole Milk", "Fat Free Milk", "Milk"] assert_search "milk", ["Milk", "Whole Milk", "Fat Free Milk"] end def test_case store_names ["Whole Milk", "Fat Free Milk", "Milk"] assert_search "MILK", ...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false
ankane/searchkick
https://github.com/ankane/searchkick/blob/107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b/test/misspellings_test.rb
test/misspellings_test.rb
require_relative "test_helper" class MisspellingsTest < Minitest::Test def test_false store_names ["abc", "abd", "aee"] assert_search "abc", ["abc"], misspellings: false end def test_distance store_names ["abbb", "aabb"] assert_search "aaaa", ["aabb"], misspellings: {distance: 2} end def te...
ruby
MIT
107d270a0d2d7e1935dc7fee1ea0305edb5e4b3b
2026-01-04T15:40:12.176737Z
false