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
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/server/database.rb
lib/xapit/server/database.rb
module Xapit module Server class Database COMMANDS = %w[query add_document remove_document update_document spelling_suggestion reopen] def initialize(path) @path = path end def xapian_database @xapian_database ||= load_database end def add_document(data) ...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/collection.rb
lib/xapit/client/collection.rb
module Xapit module Client class Collection DEFAULT_PER_PAGE = 20 attr_reader :clauses def initialize(clauses = []) @clauses = clauses end def in_classes(*classes) scope(:in_classes, classes) end def not_in_classes(*classes) scope(:not_in_class...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/index_builder.rb
lib/xapit/client/index_builder.rb
module Xapit module Client class IndexBuilder attr_reader :attributes def initialize @attributes = {} end def text(*args, &block) add_attribute(:text, *args, &block) end def field(*args, &block) add_attribute(:field, *args, &block) end def...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/membership.rb
lib/xapit/client/membership.rb
module Xapit module Client module Membership def self.included(base) base.extend ClassMethods end module ClassMethods def xapit(&block) @xapit_index_builder = IndexBuilder.new @xapit_index_builder.instance_eval(&block) include AdditionalMethods unle...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/railtie.rb
lib/xapit/client/railtie.rb
module Xapit module Client class Railtie < Rails::Railtie initializer "xapit.config" do path = Rails.root.join("config/xapit.yml") Xapit.load_config(path, Rails.env) if path.exist? end initializer "xapit.membership" do ActiveRecord::Base.send(:include, Xapit::Client::Mem...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/facet.rb
lib/xapit/client/facet.rb
module Xapit module Client class Facet attr_reader :name, :options def initialize(attribute, options, applied_facets = []) @name = attribute.to_s.gsub("_", " ").gsub(/\b([a-z])/) { $1.to_s.upcase } @options = options.map { |option| FacetOption.new(attribute, option, applied_facets) } ...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/facet_option.rb
lib/xapit/client/facet_option.rb
module Xapit module Client class FacetOption attr_reader :count, :attribute def initialize(attribute, option, applied_facets = []) @attribute = attribute @value = option[:value] @count = option[:count].to_i @applied_facets = applied_facets end def identifie...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/remote_database.rb
lib/xapit/client/remote_database.rb
module Xapit module Client class RemoteDatabase def initialize(url) @url = url end Xapit::Server::Database::COMMANDS.each do |command| define_method(command) do |options| request(command, options) end end def request(command, options) uri =...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/tasks.rb
lib/xapit/client/tasks.rb
require "rack" require "fileutils" namespace :xapit do desc "Index all models for Xapit search" task :index => :environment do raise "No Xapian database specified in config." if Xapit.config[:database_path].blank? FileUtils.rm_rf("tmp/xapit") if File.exist? "tmp/xapit" FileUtils.mv(Xapit.config[:databa...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/model_adapters/active_record_adapter.rb
lib/xapit/client/model_adapters/active_record_adapter.rb
module Xapit module Client class ActiveRecordAdapter < AbstractModelAdapter def self.for_class?(model_class) model_class <= ActiveRecord::Base end def setup @model_class.after_create do |member| member.class.xapit_index_builder.add_document(member) if Xapit.config[:ena...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/model_adapters/abstract_model_adapter.rb
lib/xapit/client/model_adapters/abstract_model_adapter.rb
module Xapit module Client class AbstractModelAdapter def self.inherited(subclass) @@subclasses ||= [] @@subclasses << subclass end def self.adapter_class(model_class) @@subclasses.detect { |subclass| subclass.for_class?(model_class) } || DefaultModelAdapter end ...
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/xapit/client/model_adapters/default_model_adapter.rb
lib/xapit/client/model_adapters/default_model_adapter.rb
module Xapit module Client class DefaultModelAdapter < AbstractModelAdapter # This adapter is used when no matching adapter is found end end end
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
ryanb/xapit
https://github.com/ryanb/xapit/blob/06580dcf5338ccef6e2df10783cd6e1e98ca2d3d/lib/generators/xapit/install_generator.rb
lib/generators/xapit/install_generator.rb
module Xapit module Generators class InstallGenerator < Rails::Generators::Base def self.source_root File.dirname(__FILE__) + "/templates" end def copy_files copy_file "xapit.yml", "config/xapit.yml" copy_file "xapit.ru", "xapit.ru" end end end end
ruby
MIT
06580dcf5338ccef6e2df10783cd6e1e98ca2d3d
2026-01-04T17:42:57.589213Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/spec/vueport_spec.rb
spec/vueport_spec.rb
require 'spec_helper' describe Vueport do it 'has a version number' do expect(Vueport::VERSION).not_to be nil end end
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/spec/spec_helper.rb
spec/spec_helper.rb
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'bundler' require 'action_view' require 'vueport' require 'webmock/rspec' WebMock.disable_net_connect! Bundler.require :default, :development, :test
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/spec/vueport/helper_spec.rb
spec/vueport/helper_spec.rb
require 'spec_helper' describe Vueport::Helper do include ActionView::Helpers include ActionView::Context include described_class describe 'vueport' do let(:content) { 'content' } let(:renderer) { instance_double('Renderer', render: 'result') } let(:request) { double('request', path: path) } l...
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/spec/vueport/renderer_spec.rb
spec/vueport/renderer_spec.rb
require 'spec_helper' shared_examples_for 'a basic renderer' do it 'serves an empty wrapper' do expect(subject.render).to have_tag wrapper_selector, text: '' end it 'serves the original template' do expect_to_contain_original_template end end describe Vueport::Renderer do include RSpecHtmlMatchers ...
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/spec/vueport/lint_spec.rb
spec/vueport/lint_spec.rb
require 'spec_helper' RSpec.describe 'Rubocop' do let!(:files) do current_sha = `git rev-parse --verify HEAD`.strip! files = `git diff #{current_sha} --name-only | grep .rb | grep -v spec` files.tr!("\n", ' ') end context 'given the files that have changed' do subject(:report) { `bundle exec rub...
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/spec/vueport/node_client_spec.rb
spec/vueport/node_client_spec.rb
require 'spec_helper' describe Vueport::NodeClient do describe '#run!' do let(:content) { '<content>' } subject { described_class.new(content) } let(:url_matcher) { 'http://localhost:5000' } context 'when node renders successfully' do let!(:node_server) { stub_request(:post, url_matcher).to_re...
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/spec/vueport/generator_spec.rb
spec/vueport/generator_spec.rb
require 'spec_helper' require 'rails/generators' require 'action_controller' require 'generators/vueport/install_generator' require 'ammeter/init' require 'fileutils' RSpec.describe Vueport::InstallGenerator, type: :generator do destination File.expand_path('../../../tmp/example', __FILE__) let(:files) { %w(packag...
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/lib/vueport.rb
lib/vueport.rb
require 'vueport/helper' require 'vueport/renderer' require 'vueport/node_client' require 'vueport/version' module Vueport module_function def config @config ||= { server_host: 'localhost', server_port: 5000, server_config_file: 'config/vueport/webpack.server.conf', client_config_file:...
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/lib/generators/vueport/install_generator.rb
lib/generators/vueport/install_generator.rb
module Vueport class InstallGenerator < ::Rails::Generators::Base source_root File.expand_path('../template', __FILE__) desc 'Install extras for using Vue with WebpackRails' def add_webpack_rails gem 'webpack-rails' gem 'foreman' end def add_to_gitignore append_to_file '.gitig...
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/lib/vueport/version.rb
lib/vueport/version.rb
module Vueport VERSION = '0.1.5'.freeze end
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/lib/vueport/node_client.rb
lib/vueport/node_client.rb
module Vueport class RenderError < StandardError; end class NodeClient attr_accessor :content, :path def initialize(content, path: '/') self.content = content self.path = path end def run! render.force_encoding('UTF-8').encode!.html_safe end private def render ...
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/lib/vueport/railtie.rb
lib/vueport/railtie.rb
require 'rails' require 'rails/railtie' require 'vueport' module Vueport # :nodoc: class Railtie < ::Rails::Railtie Vueport.configure do |config| config[:ssr_enabled] = ::Rails.env.production? end config.after_initialize do ActiveSupport.on_load(:action_view) do include Vueport::He...
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/lib/vueport/renderer.rb
lib/vueport/renderer.rb
module Vueport class Renderer include ActionView::Helpers::TagHelper CONTENT_WRAPPER_ID = 'vueport-wrapper'.freeze TEMPLATE_ID = 'vueport-template'.freeze attr_accessor :content, :path def initialize(content, path: '/') self.content = content self.path = path end def render...
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
samtgarson/vueport
https://github.com/samtgarson/vueport/blob/3349afae67fac77d316ac22fc024368c8c20f06b/lib/vueport/helper.rb
lib/vueport/helper.rb
module Vueport module Helper def vueport(content = nil, &block) content = capture(&block) if block_given? Vueport::Renderer.new(content, path: request.path).render end end end
ruby
MIT
3349afae67fac77d316ac22fc024368c8c20f06b
2026-01-04T17:42:53.738869Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/test/hike_test.rb
test/hike_test.rb
require "minitest/autorun" require "hike" FIXTURE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "fixtures")) module Hike if defined? Minitest::Test klass = Minitest::Test elsif defined? MiniTest::Unit::TestCase klass = MiniTest::Unit::TestCase end class Test < klass end end
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/test/test_normalized_array.rb
test/test_normalized_array.rb
require "hike_test" class UppercaseArray < Hike::NormalizedArray def normalize_element(element) element.upcase end end class NormalizedArrayTest < Hike::Test def setup @array = UppercaseArray.new end def test_brackets_with_start_and_length @array.push "a", "b", "c" @array[0, 2] = ["d"] ...
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/test/test_trail.rb
test/test_trail.rb
require "hike_test" require "fileutils" module TrailTests def fixture_path(path) File.expand_path(File.join(FIXTURE_ROOT, path)) end def test_root assert_equal FIXTURE_ROOT, trail.root end def test_paths assert_equal [ fixture_path("app/views"), fixture_path("vendor/plugins/signal_i...
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/test/test_fileutils.rb
test/test_fileutils.rb
require "hike_test" require "pathname" class FileUtilsTest < Hike::Test def test_stat assert_kind_of File::Stat, Hike::FileUtils.stat(FIXTURE_ROOT) refute Hike::FileUtils.stat("/tmp/hike/missingfile") end def test_entires expected = [ "application.js.coffee.erb", "application.js.coffee.s...
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/lib/hike.rb
lib/hike.rb
module Hike VERSION = "2.1.3" autoload :CachedTrail, "hike/cached_trail" autoload :Extensions, "hike/extensions" autoload :FileUtils, "hike/fileutils" autoload :NormalizedArray, "hike/normalized_array" autoload :Paths, "hike/paths" autoload :Trail, "hike/trail" end
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/lib/hike/extensions.rb
lib/hike/extensions.rb
require 'hike/normalized_array' module Hike # `Extensions` is an internal collection for tracking extension names. class Extensions < NormalizedArray # Extensions added to this array are normalized with a leading # `.`. # # extensions << "js" # extensions << ".css" # # exten...
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/lib/hike/fileutils.rb
lib/hike/fileutils.rb
module Hike module FileUtils extend self # Like `File.stat`. Returns nil if the file does not exist. def stat(path) if File.exist?(path) File.stat(path.to_s) else nil end end # A version of `Dir.entries` that filters out `.` files and `~` swap files. # Retur...
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/lib/hike/cached_trail.rb
lib/hike/cached_trail.rb
module Hike # `CachedTrail` is an internal cached variant of `Trail`. It assumes the # file system does not change between `find` calls. All `stat` and # `entries` calls are cached for the lifetime of the `CachedTrail` object. class CachedTrail include FileUtils # `CachedTrail#paths` is an immutable `P...
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/lib/hike/trail.rb
lib/hike/trail.rb
require 'pathname' require 'hike/cached_trail' require 'hike/extensions' require 'hike/paths' module Hike # `Trail` is the public container class for holding paths and extensions. class Trail include FileUtils # `Trail#paths` is a mutable `Paths` collection. # # trail = Hike::Trail.new # ...
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/lib/hike/paths.rb
lib/hike/paths.rb
require 'pathname' require 'hike/normalized_array' module Hike # `Paths` is an internal collection for tracking path strings. class Paths < NormalizedArray def initialize(root = ".") @root = Pathname.new(root) super() end # Relative paths added to this array are expanded relative to `@root...
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
sstephenson/hike
https://github.com/sstephenson/hike/blob/3abf0b3feb47c26911f8cedf2cd409471fd26da1/lib/hike/normalized_array.rb
lib/hike/normalized_array.rb
module Hike # `NormalizedArray` is an internal abstract wrapper class that calls # a callback `normalize_element` anytime an element is added to the # Array. # # `Extensions` and `Paths` are subclasses of `NormalizedArray`. class NormalizedArray < Array def initialize super() end def []=(...
ruby
MIT
3abf0b3feb47c26911f8cedf2cd409471fd26da1
2026-01-04T17:43:02.220025Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/tools/generate-examples.rb
tools/generate-examples.rb
#!/usr/bin/env ruby # frozen_string_literal: true require "fileutils" require "pathname" VERBOSE = false EXAMPLES_DIR = File.expand_path("../examples", __dir__) GraalVMOld = Struct.new(:url, :dir) do def name dir end def tarball @tarball ||= File.basename(url) end def install system("curl", "...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/spec_helpers.rb
spec/seafoam/spec_helpers.rb
# frozen_string_literal: true module Seafoam module SpecHelpers GRAALVM_VERSIONS = [ "graalvm-ce-java11-21.2.0", "graalvm-ce-java17-22.3.1", "graalvm-ce-java21-23.1.2", "graalvm-gftc-java21-23.1.2", "graalvm-ce-java22-24.0.0", "graalvm-gftc-java22-24.0.0", ].freeze SA...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/graph_spec.rb
spec/seafoam/graph_spec.rb
# frozen_string_literal: true require "seafoam" require "rspec" describe Seafoam::Graph do describe "#initialize" do it "set properties" do graph = Seafoam::Graph.new(a: 12) expect(graph.props[:a]).to(eq(12)) end end describe "#create_node" do it "adds a node to the graph" do gra...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/markdown_write_spec.rb
spec/seafoam/markdown_write_spec.rb
# frozen_string_literal: true require "stringio" require "seafoam" require "rspec" require_relative "spec_helpers" describe Seafoam::MarkdownWriter do describe "#write_graph" do before :all do file = File.expand_path("../../examples/graalvm-ce-java11-21.2.0/fib-java.bgv.gz", __dir__) parser = Sea...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/spotlight_spec.rb
spec/seafoam/spotlight_spec.rb
# frozen_string_literal: true require "seafoam" require "rspec" describe Seafoam::Spotlight do before :each do file = File.expand_path("../../examples/graalvm-ce-java11-21.2.0/fib-java.bgv.gz", __dir__) parser = Seafoam::BGV::BGVParser.new(file) parser.read_file_header parser.skip_document_props ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/passes_spec.rb
spec/seafoam/passes_spec.rb
# frozen_string_literal: true require "seafoam" require "rspec" describe Seafoam::Passes do describe "#apply" do it "asks passes if they apply" do check_applied = false Class.new(Seafoam::Pass) do singleton_class.define_method(:applies?) do |_graph| check_applied = true ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/graphviz_writer_spec.rb
spec/seafoam/graphviz_writer_spec.rb
# frozen_string_literal: true require "stringio" require "seafoam" require "rspec" require_relative "spec_helpers" describe Seafoam::GraphvizWriter do describe "#write_graph" do before :all do file = File.expand_path("../../examples/graalvm-ce-java11-21.2.0/fib-java.bgv.gz", __dir__) parser = Sea...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/command_spec.rb
spec/seafoam/command_spec.rb
# frozen_string_literal: true require "stringio" require "tmpdir" require "seafoam" require "rspec" require_relative "spec_helpers" describe Seafoam::Commands do before :all do @fib_java = File.expand_path("../../examples/graalvm-ce-java11-21.2.0/fib-java.bgv.gz", __dir__) @fib_ruby = File.expand_path("....
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/mermaid_write_spec.rb
spec/seafoam/mermaid_write_spec.rb
# frozen_string_literal: true require "stringio" require "seafoam" require "rspec" require_relative "spec_helpers" describe Seafoam::MermaidWriter do describe "#write_graph" do before :all do file = File.expand_path("../../examples/graalvm-ce-java11-21.2.0/fib-java.bgv.gz", __dir__) parser = Seaf...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/json_writer_spec.rb
spec/seafoam/json_writer_spec.rb
# frozen_string_literal: true require "stringio" require "seafoam" require "rspec" require_relative "spec_helpers" describe Seafoam::JSONWriter do describe "#prepare_json" do it "transforms a NaN to the string [NaN]" do expect(Seafoam::JSONWriter.prepare_json({ a: 1.0, b: Float::NAN, c: 2.0 })).to(eq({...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/bgv/bgv_parser_spec.rb
spec/seafoam/bgv/bgv_parser_spec.rb
# frozen_string_literal: true require "seafoam" require "rspec" require_relative "../spec_helpers" describe Seafoam::BGV::BGVParser do before :all do @fib_java_bgv = File.expand_path("../../../examples/graalvm-ce-java11-21.2.0/fib-java.bgv.gz", __dir__) end it "can read full files" do Seafoam::SpecHe...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/binary/io_binary_reader_spec.rb
spec/seafoam/binary/io_binary_reader_spec.rb
# frozen_string_literal: true require "stringio" require "seafoam" require "rspec" describe Seafoam::Binary::IOBinaryReader do describe "#read_utf8" do it "reads a UTF-8 string" do string = "abc😀" reader = Seafoam::Binary::IOBinaryReader.new(StringIO.new(string)) expect(reader.read_utf8(str...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/passes/truffle_spec.rb
spec/seafoam/passes/truffle_spec.rb
# frozen_string_literal: true require "seafoam" require "rspec" require_relative "../spec_helpers" describe Seafoam::Passes::TrufflePass do it "does not apply to Java graphs" do expect(Seafoam::Passes::TrufflePass.applies?(Seafoam::SpecHelpers.example_graph("fib-java", 0))).to(be(false)) end it "does not...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/passes/graal_spec.rb
spec/seafoam/passes/graal_spec.rb
# frozen_string_literal: true require "seafoam" require "rspec" require_relative "../spec_helpers" describe Seafoam::Passes::GraalPass do it "applies to Graal graphs" do expect(Seafoam::Passes::GraalPass.applies?(Seafoam::SpecHelpers.example_graph("fib-java", 0))).to(be(true)) end it "does not apply to T...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/spec/seafoam/passes/fallback_spec.rb
spec/seafoam/passes/fallback_spec.rb
# frozen_string_literal: true require "seafoam" require "rspec" describe Seafoam::Passes::FallbackPass do it "always applies" do expect(Seafoam::Passes::FallbackPass.applies?(Seafoam::Graph.new)).to(be(true)) end it "adds a label annotation when there is a label property" do graph = Seafoam::Graph.new...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/examples/fib.rb
examples/fib.rb
# % ruby --jvm --experimental-options --engine.CompileOnly=fib --engine.TraceCompilation --engine.NodeSourcePositions --engine.MultiTier=false --engine.Inlining=false --vm.Dgraal.Dump=Truffle:1 fib.rb 14 def fib(n) if n <= 1 n else fib(n - 1) + fib(n - 2) end end loop do ARGV.each do |arg| fib(Int...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/examples/ruby/clamps.rb
examples/ruby/clamps.rb
# ruby --experimental-options --engine.CompileOnly=clamp_low,clamp_high --vm.Dgraal.Dump=Truffle:2 clamps.rb def clamp_high(min, max, value) [min, max, value].sort[1] end def clamp_low(min, max, value) if value > max max elsif value < min min else value end end loop do clamp_high(10, 90, ran...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/examples/ruby/ruby_examples.rb
examples/ruby/ruby_examples.rb
# truffleruby_primitives: true # % ruby --jvm --experimental-options --engine.OSR=false --engine.MultiTier=false --engine.TraceCompilation --engine.InlineOnly=~Object#opaque_,~Object#static_call,~ExampleObject#instance_call --vm.Dgraal.Dump=Truffle:1 ruby_examples.rb RANDOM = Random.new EXCEPTION = Exception.new def...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/examples/graalvm-ce-java11-21.2.0/ruby/clamps.rb
examples/graalvm-ce-java11-21.2.0/ruby/clamps.rb
# ruby --experimental-options --engine.CompileOnly=clamp_low,clamp_high --vm.Dgraal.Dump=Truffle:2 clamps.rb def clamp_high(min, max, value) [min, max, value].sort[1] end def clamp_low(min, max, value) if value > max max elsif value < min min else value end end loop do clamp_high(10, 90, ran...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/examples/graalvm-ce-java11-21.2.0/ruby/ruby_examples.rb
examples/graalvm-ce-java11-21.2.0/ruby/ruby_examples.rb
# truffleruby_primitives: true # % ruby --jvm --experimental-options --engine.OSR=false --engine.MultiTier=false --engine.TraceCompilation --engine.InlineOnly=~Object#opaque_,~Object#static_call,~ExampleObject#instance_call --vm.Dgraal.Dump=Truffle:1 ruby_examples.rb RANDOM = Random.new EXCEPTION = Exception.new def...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam.rb
lib/seafoam.rb
# frozen_string_literal: true require "seafoam/version" require "seafoam/binary/io_binary_reader" require "seafoam/bgv/bgv_parser" require "seafoam/colors" require "seafoam/graph" require "seafoam/graal/graph_description" require "seafoam/graal/source" require "seafoam/graal/pi" require "seafoam/passes" require "seafo...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/passes.rb
lib/seafoam/passes.rb
# frozen_string_literal: true module Seafoam # Passes are routines to read the graph and apply properties which tools, # such as the render command, can use to show more understandable output. module Passes class << self # Apply all applicable passes to a graph. def apply(graph, options = {}) ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/graphviz_writer.rb
lib/seafoam/graphviz_writer.rb
# frozen_string_literal: true module Seafoam # A writer from graphs to the Graphviz DOT format, including all the # formatting. class GraphvizWriter def initialize(stream) @stream = stream end # Write a graph. def write_graph(graph, hidpi = false, draw_blocks = false) inline_attrs = ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/version.rb
lib/seafoam/version.rb
# frozen_string_literal: true module Seafoam MAJOR_VERSION = 0 MINOR_VERSION = 17 VERSION = "#{MAJOR_VERSION}.#{MINOR_VERSION}" end
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/spotlight.rb
lib/seafoam/spotlight.rb
# frozen_string_literal: true module Seafoam # Spotlight can *light* nodes, which makes them visible, their adjacent nodes # visible by grey, and other nodes invisible. Multiple nodes can be *lit*. class Spotlight def initialize(graph) @graph = graph end # Mark a node as lit by the spotlight. ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/graph.rb
lib/seafoam/graph.rb
# frozen_string_literal: true require "set" module Seafoam # A graph, with properties, nodes, and edges. We don't encapsulate the graph # too much - be careful. class Graph attr_reader :props, :nodes, :edges, :blocks, :new_id def initialize(props = nil) @props = props || {} @nodes = {} ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/search.rb
lib/seafoam/search.rb
# frozen_string_literal: true require "set" module Seafoam class BFS attr_reader :root def initialize(root) @root = root end def search(&block) queue = root.outputs.collect(&:to) visited = Set.new until queue.empty? entry = queue.shift visited << entry ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/mermaid_writer.rb
lib/seafoam/mermaid_writer.rb
# frozen_string_literal: true module Seafoam # A writer from graphs to the Mermaid format. Re-uses the Graphviz writer, # just adapting for the syntax. Attributes are cherry-picked, and more # things are left to defaults. class MermaidWriter < GraphvizWriter def initialize(*args) super(*args) @...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/markdown_writer.rb
lib/seafoam/markdown_writer.rb
# frozen_string_literal: true module Seafoam # A writer from graphs to Markdown format, with an embedded Mermaid graph. class MarkdownWriter def initialize(stream) @stream = stream end # Write a graph. def write_graph(graph) @stream.puts "```mermaid" mermaid = MermaidWriter.new(@...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/json_writer.rb
lib/seafoam/json_writer.rb
# frozen_string_literal: true require "json" module Seafoam # Write files in a JSON format. class JSONWriter def initialize(out) @out = out end def write(name, graph) nodes = [] edges = [] graph.nodes.each_value do |node| nodes.push( id: node.id, p...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/commands.rb
lib/seafoam/commands.rb
# frozen_string_literal: true require "json" require "set" module Seafoam # Implementations of the command-line commands that you can run in Seafoam. class Commands def initialize(out) @out = out end # Run the general seafoam command. def seafoam(*args) first, *args = args if f...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/colors.rb
lib/seafoam/colors.rb
# frozen_string_literal: true module Seafoam # Colors from and derived from the TruffleRuby logo. # TruffleRuby logo Copyright (C) 2017 Talkdesk, Inc. # Licensed under CC BY 4.0: https://creativecommons.org/licenses/by/4.0/ WHITE_ICE = "#d7ede7" CRUISE = "#b8ddd1" KEPPEL = "#3cb4a4" CARISSMA = "#e98693...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/isabelle_writer.rb
lib/seafoam/isabelle_writer.rb
# frozen_string_literal: true module Seafoam # Write graphs in the Isabelle file format. class IsabelleWriter def initialize(out) @out = out end def write(index, name, graph) # definition eg_short_cut_or1 :: IRGraph where # "eg_short_cut_or1 = # (add_node 14 ReturnNode [1...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/bgv/bgv_parser.rb
lib/seafoam/bgv/bgv_parser.rb
# frozen_string_literal: true require "stringio" require "zlib" module Seafoam module BGV # A parser for BGV files. It's a push-pull streaming interface that you need # to drive with what you want next from the file. It's slightly complicated # and some code is duplicated in order to support skipping ov...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/binary/io_binary_reader.rb
lib/seafoam/binary/io_binary_reader.rb
# frozen_string_literal: true module Seafoam module Binary # An adapter to read binary values from an IO stream. class IOBinaryReader def initialize(io) @io = io end def read_utf8(length) read_bytes(length).force_encoding(Encoding::UTF_8) end def read_bytes(len...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/graal/source.rb
lib/seafoam/graal/source.rb
# frozen_string_literal: true module Seafoam module Graal # Routines for understanding source positions in Graal. module Source class << self def walk(source_position, &block) results = [] caller = source_position while caller method = caller[:method] ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/graal/pi.rb
lib/seafoam/graal/pi.rb
# frozen_string_literal: true module Seafoam module Graal # Routines for understanding pi nodes in Graal. module Pi class << self # Find the actual value behind potentially a chain of pi nodes. def follow_pi_object(node) node = node.edges.find { |edge| edge.props[:name] == "ob...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/graal/graph_description.rb
lib/seafoam/graal/graph_description.rb
# frozen_string_literal: true module Seafoam module Graal # Provides a high level description of a Graal graph's features. class GraphDescription ATTRIBUTES = [:branches, :calls, :deopts, :linear, :loops] ATTRIBUTES.each { |attr| attr_accessor(attr) unless attr == :linear } attr_reader :no...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/formatters/text.rb
lib/seafoam/formatters/text.rb
# frozen_string_literal: true module Seafoam module Formatters module Text # A plain-text formatter for the `describe` command. class DescribeFormatter < Seafoam::Formatters::Base::DescribeFormatter def format notes = Seafoam::Graal::GraphDescription::ATTRIBUTES.select { |attr| desc...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/formatters/formatters.rb
lib/seafoam/formatters/formatters.rb
# frozen_string_literal: true module Seafoam # Formatters are the mechanism by which `seafoam` command output is presented to the user. module Formatters autoload :Base, "seafoam/formatters/base" autoload :Json, "seafoam/formatters/json" autoload :Text, "seafoam/formatters/text" end end
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/formatters/json.rb
lib/seafoam/formatters/json.rb
# frozen_string_literal: true require "json" module Seafoam module Formatters module Json # A JSON-based formatter for the `describe` command. class DescribeFormatter < Seafoam::Formatters::Base::DescribeFormatter def format ret = Seafoam::Graal::GraphDescription::ATTRIBUTES.map { ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/formatters/base.rb
lib/seafoam/formatters/base.rb
# frozen_string_literal: true module Seafoam module Formatters module Base # Formats the output of the `describe` command. class DescribeFormatter attr_reader :graph, :description def initialize(graph, description) @graph = graph @description = description ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/passes/graal.rb
lib/seafoam/passes/graal.rb
# frozen_string_literal: true module Seafoam module Passes # The Graal pass applies if it looks like it was compiled by Graal or # Truffle. class GraalPass < Pass class << self def applies?(graph) graph.props.values.any? do |v| TRIGGERS.any? { |t| v.to_s.include?(t) } ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/passes/truffle.rb
lib/seafoam/passes/truffle.rb
# frozen_string_literal: true require "tsort" module Seafoam module Passes # The Truffle pass applies if it looks like it was compiled by Truffle. class TrufflePass < Pass class << self def applies?(graph) graph.props.values.any? do |v| TRIGGERS.any? { |t| v.to_s.include?...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/passes/fallback.rb
lib/seafoam/passes/fallback.rb
# frozen_string_literal: true module Seafoam module Passes # The fallback pass always applies, and adds some basic properties. # Works for example with Truffle AST and call graphs, but also means anyone # can emit a graph with 'label' properties and we can do something useful # with it. class Fal...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/passes/truffle_translators/default.rb
lib/seafoam/passes/truffle_translators/default.rb
# frozen_string_literal: true module Seafoam module Passes module TruffleTranslators class Default def translate_argument_load(index) index.to_s end end end end end
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/passes/truffle_translators/translators.rb
lib/seafoam/passes/truffle_translators/translators.rb
# frozen_string_literal: true require "set" module Seafoam module Passes module TruffleTranslators autoload :Default, "seafoam/passes/truffle_translators/default" autoload :TruffleRuby, "seafoam/passes/truffle_translators/truffleruby" TRUFFLE_LANGUAGES = { "org.truffleruby" => "Truffl...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
Shopify/seafoam
https://github.com/Shopify/seafoam/blob/d3fd222d31141829dd59a2e22a909ecf9127e351/lib/seafoam/passes/truffle_translators/truffleruby.rb
lib/seafoam/passes/truffle_translators/truffleruby.rb
# frozen_string_literal: true module Seafoam module Passes module TruffleTranslators class TruffleRuby < Default TRUFFLERUBY_ARGS = [ "DECLARATION_FRAME", "CALLER_SPECIAL_VARIABLES", "METHOD", "DECLARATION_CONTEXT", "FRAME_ON_STACK_MARKER", ...
ruby
MIT
d3fd222d31141829dd59a2e22a909ecf9127e351
2026-01-04T17:41:25.705472Z
false
flatterline/jekyll-plugins
https://github.com/flatterline/jekyll-plugins/blob/08d288604c40f00152c8619a5bbcb000f3a28512/simple_format.rb
simple_format.rb
module Jekyll module SimpleFormatFilter def simple_format(text) text = '' if text.nil? text = text.to_str text.gsub!(/\r\n?/, "\n") # \r\n and \r -> \n text.gsub!(/\n\n+/, "</p>\n\n<p>") # 2+ newline -> paragraph text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br ...
ruby
MIT
08d288604c40f00152c8619a5bbcb000f3a28512
2026-01-04T17:42:59.918203Z
false
flatterline/jekyll-plugins
https://github.com/flatterline/jekyll-plugins/blob/08d288604c40f00152c8619a5bbcb000f3a28512/read_more.rb
read_more.rb
module Jekyll module ReadMoreFilter def read_more(text, url) text = '' if text.nil? text = text.to_str "#{text}<a href=\"#{url}\" rel=\"nofollow\" class=\"read-more\">read more &raquo;</a>" end end end Liquid::Template.register_filter(Jekyll::ReadMoreFilter)
ruby
MIT
08d288604c40f00152c8619a5bbcb000f3a28512
2026-01-04T17:42:59.918203Z
false
flatterline/jekyll-plugins
https://github.com/flatterline/jekyll-plugins/blob/08d288604c40f00152c8619a5bbcb000f3a28512/team.rb
team.rb
module Jekyll class TeamIndex < Page def initialize(site, base, dir) @site = site @base = base @dir = dir @name = "index.html" self.read_yaml(File.join(base, '_layouts'), 'team.html') self.data['team'] = self.get_team(site) self.process(@name) end def get_team(...
ruby
MIT
08d288604c40f00152c8619a5bbcb000f3a28512
2026-01-04T17:42:59.918203Z
false
flatterline/jekyll-plugins
https://github.com/flatterline/jekyll-plugins/blob/08d288604c40f00152c8619a5bbcb000f3a28512/portfolio.rb
portfolio.rb
module Jekyll class PortfolioIndex < Page def initialize(site, base, dir) @site = site @base = base @dir = dir @name = "index.html" self.process(@name) self.read_yaml(File.join(base, '_layouts'), 'portfolio.html') self.data['projects'] = self.get_projects(site) end ...
ruby
MIT
08d288604c40f00152c8619a5bbcb000f3a28512
2026-01-04T17:42:59.918203Z
false
palkan/engems
https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/scripts/combustion/combustion_bundler_patch.rb
scripts/combustion/combustion_bundler_patch.rb
# frozen_string_literal: true # Hijack Bundler.require from Combustion.initialize! to load engine-specific group Combustion.singleton_class.prepend(Module.new do def initialize!(*args, bundler_groups: nil, **kwargs) if bundler_groups original_require = Bundler.method(:require) Bundler.define_singleto...
ruby
MIT
6b824b182676dedc10ba88ea3aa5764e36f40e14
2026-01-04T17:42:59.095107Z
false
palkan/engems
https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/scripts/bundler/component.rb
scripts/bundler/component.rb
return if Bundler::Dsl.instance_methods.include?(:component) class Bundler::Dsl def component(name, namespace: "engines") # NOTE: Change to the project root path. Dir.chdir(__dir__) do component_group = name.to_sym group :default do # Add engine as a dependency gemspec name: name...
ruby
MIT
6b824b182676dedc10ba88ea3aa5764e36f40e14
2026-01-04T17:42:59.095107Z
false
palkan/engems
https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/scripts/bundler/eval_gemfile_patch.rb
scripts/bundler/eval_gemfile_patch.rb
return if Bundler::Dsl.instance_methods.include?(:eval_gemfile_original) class Bundler::Dsl alias eval_gemfile_original eval_gemfile def eval_gemfile(gemfile, contents = nil) expanded_gemfile_path = Pathname.new(gemfile).expand_path(@gemfile&.parent) return if @gemfiles.any? { |path| path == expanded_gemf...
ruby
MIT
6b824b182676dedc10ba88ea3aa5764e36f40e14
2026-01-04T17:42:59.095107Z
false
palkan/engems
https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-factory/lib/shared-factory.rb
examples/gems/shared-factory/lib/shared-factory.rb
# frozen_string_literal: true require "common/factory"
ruby
MIT
6b824b182676dedc10ba88ea3aa5764e36f40e14
2026-01-04T17:42:59.095107Z
false
palkan/engems
https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-factory/lib/shared/factory.rb
examples/gems/shared-factory/lib/shared/factory.rb
# frozen_string_literal: true require "shared/factory/faker" require "factory_bot" # Run load hooks before loading definitions to # allow engines to register their factories ActiveSupport.run_load_hooks(:factory_bot, FactoryBot) # And only after that load Rails integration require "factory_bot_rails"
ruby
MIT
6b824b182676dedc10ba88ea3aa5764e36f40e14
2026-01-04T17:42:59.095107Z
false
palkan/engems
https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-factory/lib/shared/factory/faker.rb
examples/gems/shared-factory/lib/shared/factory/faker.rb
# frozen_string_literal: true # Faker load tons of useless locales by default # (see https://github.com/stympy/faker/tree/master/lib/locales) # # And it's impossible to configure it( # (see https://github.com/stympy/faker/blob/v1.9.3/lib/faker.rb#L14-L15) # # It's likely that we'll start using Estonian or Armenian or ...
ruby
MIT
6b824b182676dedc10ba88ea3aa5764e36f40e14
2026-01-04T17:42:59.095107Z
false
palkan/engems
https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-testing/lib/shared-testing.rb
examples/gems/shared-testing/lib/shared-testing.rb
# frozen_string_literal: true require "common/testing"
ruby
MIT
6b824b182676dedc10ba88ea3aa5764e36f40e14
2026-01-04T17:42:59.095107Z
false
palkan/engems
https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-testing/lib/common/testing.rb
examples/gems/shared-testing/lib/common/testing.rb
# frozen_string_literal: true
ruby
MIT
6b824b182676dedc10ba88ea3aa5764e36f40e14
2026-01-04T17:42:59.095107Z
false
palkan/engems
https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-testing/lib/common/testing/rails_configuration.rb
examples/gems/shared-testing/lib/common/testing/rails_configuration.rb
# frozen_string_literal: true require "shared-factory" require "rspec/rails" require "isolator" require "n_plus_one_control/rspec" require "shoulda-matchers" require "timecop" require "with_model" require "shared/testing/ext/action_dispatch_test_response" require "shared/testing/ext/n_plus_one_control_isolator" re...
ruby
MIT
6b824b182676dedc10ba88ea3aa5764e36f40e14
2026-01-04T17:42:59.095107Z
false
palkan/engems
https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-testing/lib/common/testing/rspec_configuration.rb
examples/gems/shared-testing/lib/common/testing/rspec_configuration.rb
# frozen_string_literal: true require "rspec" require "rspec/instafail" require "rspec_junit_formatter" require "rspec/support/spec/shell_out" RSpec.configure do |config| include RSpec::Support::ShellOut config.expect_with :rspec do |expectations| # This option will default to `true` in RSpec 4. It makes the...
ruby
MIT
6b824b182676dedc10ba88ea3aa5764e36f40e14
2026-01-04T17:42:59.095107Z
false