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 |
|---|---|---|---|---|---|---|---|---|
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-testing/lib/common/testing/helpers/json_response.rb | examples/gems/shared-testing/lib/common/testing/helpers/json_response.rb | # frozen_string_literal: true
module Common::Testing
module JSONResponse
# Return cached parsed request response
def json_response
@json_response ||= begin
# ensure request has been made
request
JSON.parse(response.body)
end
end
end
end
| 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/helpers/file_fixture_helper.rb | examples/gems/shared-testing/lib/common/testing/helpers/file_fixture_helper.rb | # frozen_string_literal: true
# See https://relishapp.com/rspec/rspec-rails/docs/file-fixture
module Common::Testing
module FileFixtureHelper
def fixture_file_path(*paths)
File.join(RSpec.configuration.file_fixture_path, *paths)
end
end
end
RSpec.configure do |config|
config.include Common::Testin... | 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/helpers/mailbox_for_helper.rb | examples/gems/shared-testing/lib/common/testing/helpers/mailbox_for_helper.rb | # frozen_string_literal: true
module Common::Testing
module MailboxForHelper
# Proxy object for accessing
# test deliveries to the specified email
# address
class Mailbox
attr_reader :email
delegate :count, :size, :last, to: :deliveries
def initialize(email)
@email = email... | 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/ext/combustion_bundler_patch.rb | examples/gems/shared-testing/lib/common/testing/ext/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/examples/gems/shared-testing/lib/common/testing/ext/n_plus_one_control_isolator.rb | examples/gems/shared-testing/lib/common/testing/ext/n_plus_one_control_isolator.rb | # frozen_string_literal: true
# Disable Isolator in n_plus_one_control examples
#
# Rails 5 triggers `after_commit` callbacks depending on the properties of the outer transaction:
# if it has `joinable: false` then callbacks are triggered.
# `n_plus_one_control` also uses a non-joinable transaction, but it's not coun... | 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/ext/action_dispatch_test_response.rb | examples/gems/shared-testing/lib/common/testing/ext/action_dispatch_test_response.rb | # frozen_string_literal: true
module ActionDispatch
# Make response less verbose (for rspec failure messages).
#
# Before:
# expected `#<ActionDispatch::TestResponse:0x000055c409b14a40
# @mon_owner=nil, @mon_count=0,
# @mon_mutex=#<Thread::...ext/html", @hash=45902702291960865... | 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/shared_contexts/active_job.rb | examples/gems/shared-testing/lib/common/testing/shared_contexts/active_job.rb | # frozen_string_literal: true
shared_context "active_job:perform" do
around do |ex|
was_perform = ActiveJob::Base.queue_adapter.perform_enqueued_jobs
ActiveJob::Base.queue_adapter.perform_enqueued_jobs = true
ex.run
ActiveJob::Base.queue_adapter.perform_enqueued_jobs = was_perform
end
end
RSpec.co... | 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/shared_contexts/csrf.rb | examples/gems/shared-testing/lib/common/testing/shared_contexts/csrf.rb | # frozen_string_literal: true
# Turn on forgery protection for API requests
# (to make sure that we handle (=ignore) normal CSRF protection)
shared_context "csrf:on" do
around do |ex|
save = ActionController::Base.allow_forgery_protection
ActionController::Base.allow_forgery_protection = true
ex.run
... | 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/shared_contexts/shared_request.rb | examples/gems/shared-testing/lib/common/testing/shared_contexts/shared_request.rb | # frozen_string_literal: true
shared_context "shared:request" do
subject { request; response } # rubocop:disable Style/Semicolon
end
RSpec.configure do |config|
config.include_context "shared:request", type: :request
config.include Common::Testing::JSONResponse, type: :request
end
| ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-rubocop/spec/spec_helper.rb | examples/gems/shared-rubocop/spec/spec_helper.rb | # frozen_string_literal: true
require "bundler/setup"
require "pry-byebug"
require "rspec"
require "rubocop"
require "rubocop/rspec/support"
RSpec.configure do |config|
config.filter_run_when_matching :focus
config.example_status_persistence_file_path = "tmp/rspec_examples.txt"
if config.files_to_run.one?
... | ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-rubocop/spec/cop/lint_env_spec.rb | examples/gems/shared-rubocop/spec/cop/lint_env_spec.rb | # frozen_string_literal: true
require "shared/rubocop/cop/lint_env"
describe RuboCop::Cop::Lint::Env, :config do
subject(:cop) { described_class.new(config) }
it "rejects ENV usage" do
inspect_source("a = ENV['x']")
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to include("Avoid direc... | ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-rubocop/lib/shared-rubocop.rb | examples/gems/shared-rubocop/lib/shared-rubocop.rb | # frozen_string_literal: true
require "common/rubocop"
| ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-rubocop/lib/shared/rubocop.rb | examples/gems/shared-rubocop/lib/shared/rubocop.rb | # frozen_string_literal: true
require "rubocop"
require "standard"
module Shared
module Rubocop
end
end
# Do not use the root app RuboCop exclusions in
# isolated gems stored in the same repo
# See https://github.com/rubocop-hq/rubocop/pull/4329
RuboCop::ConfigLoader.ignore_parent_exclusion = true
| ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/gems/shared-rubocop/lib/shared/rubocop/cop/lint_env.rb | examples/gems/shared-rubocop/lib/shared/rubocop/cop/lint_env.rb | # frozen_string_literal: true
require "rubocop/rspec/language"
module RuboCop
module Cop
module Lint
# This cops checks for direct usage of ENV variables and
# Rails.env
class Env < RuboCop::Cop::Cop
MSG_ENV = "Avoid direct usage of ENV in application code"
MSG_RAILS_ENV = "Avo... | ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/generators/gem/gem_generator.rb | examples/generators/gem/gem_generator.rb | # frozen_string_literal: true
class GemGenerator < Rails::Generators::NamedBase
source_root File.expand_path("templates", __dir__)
def create_engine_file
directory(".", "gems/#{name}")
chmod "gems/#{name}/bin/console", 0o755, verbose: false
end
end
| ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/generators/gem/templates/spec/rails_helper.rb | examples/generators/gem/templates/spec/rails_helper.rb | # frozen_string_literal: true
ENV["RAILS_ENV"] = "test"
require "shared/testing/rails_configuration"
| ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/generators/gem/templates/spec/spec_helper.rb | examples/generators/gem/templates/spec/spec_helper.rb | # frozen_string_literal: true
require "bundler/setup"
require "pry-byebug"
require "shared/testing/rspec_configuration"
| ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/generators/engine/engine_generator.rb | examples/generators/engine/engine_generator.rb | # frozen_string_literal: true
class EngineGenerator < Rails::Generators::NamedBase
source_root File.expand_path("templates", __dir__)
def create_engine_file
directory(".", "engines/#{name}")
chmod "engines/#{name}/bin/console", 0o755, verbose: false
chmod "engines/#{name}/bin/rails", 0o755, verbose: ... | ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/generators/engine/templates/spec/spec_helper.rb | examples/generators/engine/templates/spec/spec_helper.rb | # frozen_string_literal: true
require "bundler/setup"
require "pry-byebug"
require "shared/testing/rspec_configuration"
| ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
palkan/engems | https://github.com/palkan/engems/blob/6b824b182676dedc10ba88ea3aa5764e36f40e14/examples/generators/engine/templates/spec/internal/db/schema.rb | examples/generators/engine/templates/spec/internal/db/schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
end
| ruby | MIT | 6b824b182676dedc10ba88ea3aa5764e36f40e14 | 2026-01-04T17:42:59.095107Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/notification_spec.rb | spec/notification_spec.rb |
module RailsPushNotifications
describe Notification, type: :model do
class FakeResults
attr_reader :value1, :success, :failed
def initialize(value1, success, failed)
@value1 = value1
@success = success
@failed = failed
end
def ==(other)
other != nil && o... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/spec_helper.rb | spec/spec_helper.rb |
require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start
Bundler.setup
require 'rails'
ENV['RAILS_ENV'] = 'test'
case "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}"
when '3.2'
ENV['DATABASE_URL'] = 'sqlite3://localhost/:memory:'
require 'rails_apps/rails3_2'
require 'active_record/migration'
... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/support/factory_girl.rb | spec/support/factory_girl.rb | RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end
FactoryGirl.find_definitions
| ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/apps/apns_app_spec.rb | spec/apps/apns_app_spec.rb | module RailsPushNotifications
describe APNSApp, type: :model do
it 'creates an instance given valid attributes' do
APNSApp.create! attributes_for :apns_app
end
describe 'validations' do
let(:app) { build :apns_app }
it 'requires an apns dev cert' do
app.apns_dev_cert = nil
... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/apps/gcm_app_spec.rb | spec/apps/gcm_app_spec.rb | module RailsPushNotifications
describe GCMApp, type: :model do
it 'creates an instance given valid attributes' do
GCMApp.create! attributes_for :gcm_app
end
describe 'validations' do
let(:app) { build :gcm_app }
it 'requires a gcm key' do
app.gcm_key = nil
expect(app).... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/apps/mpns_app_spec.rb | spec/apps/mpns_app_spec.rb | module RailsPushNotifications
describe MPNSApp, type: :model do
it 'creates an instance given valid attributes' do
MPNSApp.create! attributes_for :mpns_app
end
describe 'validations' do
let(:app) { build :mpns_app }
it 'requires the certificate' do
app.cert = nil
expe... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/factories/notifications.rb | spec/factories/notifications.rb |
FactoryGirl.define do
factory :apns_notification, class: 'RailsPushNotifications::Notification' do
association :app, factory: :apns_app, strategy: :create
data a: 1
destinations ['1']
end
factory :gcm_notification, class: 'RailsPushNotifications::Notification' do
association :app, ... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/factories/apps.rb | spec/factories/apps.rb | FactoryGirl.define do
factory :apns_app, class: 'RailsPushNotifications::APNSApp' do
apns_dev_cert 'abc'
apns_prod_cert 'def'
sandbox_mode true
end
factory :gcm_app, class: 'RailsPushNotifications::GCMApp' do
gcm_key 'abc123def456'
end
factory :mpns_app, class: 'RailsPushNotifications::MP... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/rails_apps/rails3_2.rb | spec/rails_apps/rails3_2.rb | require 'rails'
require 'rails/all'
require 'action_view/testing/resolvers'
require 'rails/test_help'
require 'rails-push-notifications'
class RailsPushNotificationsApp < Rails::Application
config.root = File.expand_path("../../..", __FILE__)
config.cache_classes = true
config.eager_load = false
config.serve... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/rails_apps/rails4.rb | spec/rails_apps/rails4.rb | require 'rails'
require 'rails/all'
require 'action_view/testing/resolvers'
require 'rails-push-notifications'
module RailsPushNotificationsApp
class Application < Rails::Application
config.root = File.expand_path("../../..", __FILE__)
config.cache_classes = true
config.eager_load = false
config.st... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/spec/generators/migrations_generator_spec.rb | spec/generators/migrations_generator_spec.rb | require 'generators/rails-push-notifications/migrations_generator'
describe RailsPushNotifications::Generators::MigrationsGenerator, type: :generator do
destination File.expand_path("../tmp", __FILE__)
before do
prepare_destination
run_generator
end
after do
rm_rf destination_root
end
it 'cr... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/rails-push-notifications.rb | lib/rails-push-notifications.rb | require 'ruby-push-notifications'
require 'rails-push-notifications/apps'
require 'rails-push-notifications/notification'
require 'rails-push-notifications/rails_push_notifications_railtie'
| ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/rails-push-notifications/rails_push_notifications_railtie.rb | lib/rails-push-notifications/rails_push_notifications_railtie.rb | module RailsPushNotifications
#
# This class exports the migrations generator to Rails
#
# @author Carlos Alonso
#
class RailsPushNotificationsRailtie < Rails::Railtie
generators do
require 'generators/rails-push-notifications/migrations_generator'
end
end
end
| ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/rails-push-notifications/version.rb | lib/rails-push-notifications/version.rb | module RailsPushNotifications
VERSION = '0.2.3'
end
| ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/rails-push-notifications/apps.rb | lib/rails-push-notifications/apps.rb | require 'rails-push-notifications/apps/base_app'
require 'rails-push-notifications/apps/apns_app'
require 'rails-push-notifications/apps/gcm_app'
require 'rails-push-notifications/apps/mpns_app'
| ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/rails-push-notifications/notification.rb | lib/rails-push-notifications/notification.rb | module RailsPushNotifications
#
# This class represents the Notification Entity.
#
# @author Carlos Alonso
#
class Notification < ActiveRecord::Base
self.table_name = 'rails_push_notifications_notifications'
# belongs_to an app
belongs_to :app, polymorphic: true
# Requires an app
vali... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/rails-push-notifications/apps/base_app.rb | lib/rails-push-notifications/apps/base_app.rb | module RailsPushNotifications
#
# Abstract. This class is the base of all application entity type.
#
# @author Carlos Alonso
#
class BaseApp < ActiveRecord::Base
self.abstract_class = true
# has_many notifications
has_many :notifications, as: :app
#
# This method will find all notific... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/rails-push-notifications/apps/mpns_app.rb | lib/rails-push-notifications/apps/mpns_app.rb | module RailsPushNotifications
#
# This class represents an Windows Phone application.
#
# @author Carlos Alonso
#
class MPNSApp < BaseApp
self.table_name = 'rails_push_notifications_mpns_apps'
# Requires the certificate
validates :cert, presence: true
private
# @return [RubyPushNotifi... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/rails-push-notifications/apps/gcm_app.rb | lib/rails-push-notifications/apps/gcm_app.rb | module RailsPushNotifications
#
# This class represents an Android GCM application.
#
# @author Carlos Alonso
#
class GCMApp < BaseApp
self.table_name = 'rails_push_notifications_gcm_apps'
# Requires a gcm_key
validates :gcm_key, presence: true
private
# @return [RubyPushNotifications... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/rails-push-notifications/apps/apns_app.rb | lib/rails-push-notifications/apps/apns_app.rb | module RailsPushNotifications
#
# This class represents an Apple iOS application.
#
# @author Carlos Alonso
#
class APNSApp < BaseApp
self.table_name = 'rails_push_notifications_apns_apps'
# Requires a development certificate
validates :apns_dev_cert, presence: true
# Requires a production ... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/generators/rails-push-notifications/migrations_generator.rb | lib/generators/rails-push-notifications/migrations_generator.rb | require 'rails/generators'
require 'rails/generators/migration'
module RailsPushNotifications
module Generators
class MigrationsGenerator < Rails::Generators::Base
include Rails::Generators::Migration
source_root File.expand_path('../templates/migrations', __FILE__)
def create_migrations
... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/generators/rails-push-notifications/templates/migrations/create_rails_push_notifications_apps.rb | lib/generators/rails-push-notifications/templates/migrations/create_rails_push_notifications_apps.rb | class CreateRailsPushNotificationsApps < ActiveRecord::Migration
def self.up
create_table :rails_push_notifications_apns_apps do |t|
t.text :apns_dev_cert
t.text :apns_prod_cert
t.boolean :sandbox_mode, deafult: true
t.timestamps null: false
end
create_table :rails_push_notificat... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
calonso/rails-push-notifications | https://github.com/calonso/rails-push-notifications/blob/820a5bc4a32384624d6ced8f06f2da478497b001/lib/generators/rails-push-notifications/templates/migrations/create_rails_push_notifications_notifications.rb | lib/generators/rails-push-notifications/templates/migrations/create_rails_push_notifications_notifications.rb | class CreateRailsPushNotificationsNotifications < ActiveRecord::Migration
def change
create_table :rails_push_notifications_notifications do |t|
t.text :destinations
t.integer :app_id
t.string :app_type
t.text :data
t.text :results
t.integer :success
t.integer :failed
... | ruby | MIT | 820a5bc4a32384624d6ced8f06f2da478497b001 | 2026-01-04T17:43:04.054834Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/spec/client_spec.rb | spec/client_spec.rb | require 'spec_helper'
module Jimson
describe Client do
BOILERPLATE = {'jsonrpc' => '2.0', 'id' => 1}
before(:each) do
@resp_mock = double('http_response')
ClientHelper.stub(:make_id).and_return(1)
end
after(:each) do
end
describe "hidden methods" do
it "should reveal insp... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/spec/router_spec.rb | spec/router_spec.rb | require 'spec_helper'
module Jimson
describe Router do
let(:router) { Router.new(opts) }
let(:opts) { {} }
class RouterFooHandler
extend Jimson::Handler
def hi
'hi'
end
end
class RouterBarHandler
extend Jimson::Handler
def bye
'bye'
end
... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/spec/server_spec.rb | spec/server_spec.rb | require 'spec_helper'
require 'rack/test'
module Jimson
describe Server do
include Rack::Test::Methods
class TestHandler
extend Jimson::Handler
def subtract(a, b = nil)
if a.is_a?(Hash)
return a['minuend'] - a['subtrahend']
else
return a - ... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/spec/handler_spec.rb | spec/handler_spec.rb | require 'spec_helper'
module Jimson
describe Handler do
class FooHandler
extend Jimson::Handler
jimson_expose :to_s, :bye
jimson_exclude :hi, :bye
def hi
'hi'
end
def bye
'bye'
end
def to_s
'foo'
end
def so_exposed
... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/spec/spec_helper.rb | spec/spec_helper.rb | require 'rubygems'
$:.unshift(File.dirname(__FILE__) + '/../lib/')
require 'jimson'
require 'bundler/setup'
require 'multi_json'
SPEC_URL = 'http://localhost:8999'
| ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson.rb | lib/jimson.rb | require 'rubygems'
require 'jimson/handler'
require 'jimson/router'
require 'jimson/server'
require 'jimson/client'
module Jimson
end
| ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson/version.rb | lib/jimson/version.rb | module Jimson
VERSION = '0.13.0'
end
| ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson/response.rb | lib/jimson/response.rb | module Jimson
class Response
attr_accessor :result, :error, :id
def initialize(id)
@id = id
end
def to_h
h = {'jsonrpc' => '2.0'}
h.merge!('result' => @result) if !!@result
h.merge!('error' => @error) if !!@error
h.merge!('id' => @id)
end
def is_error?
!!... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson/router.rb | lib/jimson/router.rb | require 'jimson/router/map'
require 'forwardable'
module Jimson
class Router
extend Forwardable
def_delegators :@map, :handler_for_method,
:root,
:namespace,
:jimson_methods,
:strip_method_namespace
... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson/handler.rb | lib/jimson/handler.rb | module Jimson
module Handler
def jimson_default_methods
self.instance_methods.map(&:to_s) - Object.methods.map(&:to_s)
end
def jimson_expose(*methods)
@jimson_exposed_methods ||= []
@jimson_exposed_methods += methods.map(&:to_s)
end
def jimson_exclude(*methods)
@jims... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson/client.rb | lib/jimson/client.rb | require 'blankslate'
require 'multi_json'
require 'rest-client'
require 'jimson/request'
require 'jimson/response'
module Jimson
class ClientHelper
JSON_RPC_VERSION = '2.0'
def self.make_id
rand(10**12)
end
def initialize(url, opts = {}, namespace = nil, client_opts = {})
URI.parse(url)... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson/server.rb | lib/jimson/server.rb | require 'rack'
require 'rack/request'
require 'rack/response'
require 'multi_json'
require 'jimson/handler'
require 'jimson/router'
require 'jimson/server/error'
module Jimson
class Server
class System
extend Handler
def initialize(router)
@router = router
end
def listMetho... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson/request.rb | lib/jimson/request.rb | module Jimson
class Request
attr_accessor :method, :params, :id
def initialize(method, params, id = nil)
@method = method
@params = params
@id = id
end
def to_h
h = {
'jsonrpc' => '2.0',
'method' => @method
}
h.merge!('params' => @params) if !!@pa... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson/server/error.rb | lib/jimson/server/error.rb | module Jimson
class Server
class Error < StandardError
attr_accessor :code, :message
def initialize(code, message)
@code = code
@message = message
super(message)
end
def to_h
{
'code' => @code,
'message' => @message
}
e... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson/router/map.rb | lib/jimson/router/map.rb | module Jimson
class Router
#
# Provides a DSL for routing method namespaces to handlers.
# Only handles root-level and non-nested namespaces, e.g. 'foo.bar' or 'foo'.
#
class Map
def initialize(opts = {})
@routes = {}
@opts = opts
@ns_sep = opts[:ns_sep] || '.'
... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
bitboxer/jimson | https://github.com/bitboxer/jimson/blob/48ae815ac3e4411a44146b0304addc0a384429e4/lib/jimson/client/error.rb | lib/jimson/client/error.rb | module Jimson
class Client
module Error
class InvalidResponse < StandardError
def initialize(response = nil)
super("Invalid or empty response from server:\n#{response.inspect}")
end
end
class InvalidJSON < StandardError
def initialize(json)
super("Cou... | ruby | MIT | 48ae815ac3e4411a44146b0304addc0a384429e4 | 2026-01-04T17:43:03.075001Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/spec/regent_spec.rb | spec/regent_spec.rb | # frozen_string_literal: true
RSpec.describe Regent do
it "has a version number" do
expect(Regent::VERSION).not_to be nil
end
end
| ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require "regent"
require 'vcr'
VCR.configure do |config|
config.cassette_library_dir = "spec/fixtures/cassettes"
config.hook_into :webmock
config.configure_rspec_metadata!
# Filter out sensitive data like API keys
config.filter_sensitive_data('<OPENAI_API_KEY>') { ENV['OPENAI_... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/spec/regent/agent_spec.rb | spec/regent/agent_spec.rb | # frozen_string_literal: true
RSpec.describe Regent::Agent, :vcr do
let(:llm) { Regent::LLM.new(model) }
let(:agent) { Regent::Agent.new("You are an AI agent", model: llm) }
let(:tool) { PriceTool.new(name: 'price_tool', description: 'Get the price of cryptocurrencies') }
let(:spinner) { double("spinner", auto... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/spec/regent/llm_spec.rb | spec/regent/llm_spec.rb | # frozen_string_literal: true
RSpec.describe Regent::LLM do
let(:strict_mode) { true }
let(:messages) { [{ role: :user, content: "What is the capital of Japan?" }] }
subject { Regent::LLM.new(model, strict_mode: strict_mode) }
context "OpenAI", vcr: true do
let(:model) { "gpt-4o-mini" }
let(:cassette... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent.rb | lib/regent.rb | # frozen_string_literal: true
require 'securerandom'
require 'json'
require 'pastel'
require 'tty-spinner'
require 'zeitwerk'
module Regent
class Error < StandardError; end
# Your code goes here...
loader = Zeitwerk::Loader.for_gem
loader.inflector.inflect("llm" => "LLM")
loader.inflector.inflect("open_ai"... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/agent.rb | lib/regent/agent.rb | # frozen_string_literal: true
module Regent
class Agent
include Concerns::Identifiable
include Concerns::Toolable
DEFAULT_MAX_ITERATIONS = 10
def initialize(context, model:, tools: [], engine: Regent::Engine::React, **options)
super()
@context = context
@model = model.is_a?(Strin... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/session.rb | lib/regent/session.rb | # frozen_string_literal: true
module Regent
class Session
include Concerns::Identifiable
include Concerns::Durationable
class SessionError < StandardError; end
class InactiveSessionError < SessionError; end
class AlreadyStartedError < SessionError; end
def initialize
super()
@s... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/version.rb | lib/regent/version.rb | # frozen_string_literal: true
module Regent
VERSION = "0.3.4"
end
| ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/logger.rb | lib/regent/logger.rb | # frozen_string_literal: true
module Regent
class Logger
COLORS = %i[dim white green yellow red blue cyan clear].freeze
class << self
def warn_and_exit(message)
warn message
exit 1
end
end
def initialize(output: $stdout)
@pastel = Pastel.new
@spinner = build_... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/llm.rb | lib/regent/llm.rb | # frozen_string_literal: true
module Regent
class LLM
DEFAULT_RETRY_COUNT = 3
PROVIDER_PATTERNS = {
OpenAI: /^gpt-/,
Gemini: /^gemini-/,
Anthropic: /^claude-/
}.freeze
class ProviderNotFoundError < StandardError; end
class APIKeyNotFoundError < StandardError; end
class ApiE... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/toolchain.rb | lib/regent/toolchain.rb | # frozen_string_literal: true
module Regent
class Toolchain
def initialize(tools)
@tools = tools
end
attr_reader :tools
def find(name)
tools.find { |tool| tool.name.downcase == name.downcase }
end
def add(tool, context)
@tools << Regent::Tool.new(name: tool[:name].to_s, d... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/span.rb | lib/regent/span.rb | # frozen_string_literal: true
module Regent
class Span
include Concerns::Identifiable
include Concerns::Durationable
module Type
INPUT = 'INPUT'.freeze
LLM_CALL = 'LLM'.freeze
TOOL_EXECUTION = 'TOOL'.freeze
MEMORY_ACCESS = 'MEMO'.freeze
ANSWER = 'ANSWER'.freeze
def s... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/tool.rb | lib/regent/tool.rb | # frozen_string_literal: true
module Regent
class ToolError < StandardError; end
class Tool
def initialize(name:, description:)
@name = name
@description = description
end
attr_reader :name, :description
def call(argument)
raise NotImplementedError, "Tool #{name} has not implem... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/concerns/dependable.rb | lib/regent/concerns/dependable.rb | # frozen_string_literal: true
module Regent
module Concerns
module Dependable
class VersionError < StandardError; end
def self.included(base)
base.class_eval do
class << self
def depends_on(*gem_names)
@dependencies = gem_names.flatten
end
... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/concerns/durationable.rb | lib/regent/concerns/durationable.rb | # frozen_string_literal: true
module Regent
module Concerns
module Durationable
def duration
return 0 unless @start_time
(@end_time || Time.now) - @start_time
end
end
end
end
| ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/concerns/toolable.rb | lib/regent/concerns/toolable.rb | # frozen_string_literal: true
module Regent
module Concerns
module Toolable
def self.included(base)
base.class_eval do
class << self
def tool(name, description)
@function_tools ||= []
@function_tools << { name: name, description: description }
... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/concerns/identifiable.rb | lib/regent/concerns/identifiable.rb | # frozen_string_literal: true
module Regent
module Concerns
module Identifiable
def self.included(base)
base.class_eval do
attr_reader :id
end
end
private
def generate_id
@id = SecureRandom.uuid
end
def initialize(*)
generate_id
... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/llm/ollama.rb | lib/regent/llm/ollama.rb | # frozen_string_literal: true
module Regent
class LLM
class Ollama < Base
# Default host for Ollama API.
DEFAULT_HOST = "http://localhost:11434"
depends_on "faraday"
def initialize(model:, host: nil, **options)
@model = model
@host = host || DEFAULT_HOST
@options... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/llm/anthropic.rb | lib/regent/llm/anthropic.rb | # frozen_string_literal: true
module Regent
class LLM
class Anthropic < Base
MAX_TOKENS = 1000
ENV_KEY = "ANTHROPIC_API_KEY"
depends_on "ruby-anthropic", "anthropic"
def invoke(messages, **args)
parameters = {
messages: format_messages(messages),
model: model... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/llm/base.rb | lib/regent/llm/base.rb | # frozen_string_literal: true
module Regent
class LLM
Result = Struct.new(:model, :content, :input_tokens, :output_tokens, keyword_init: true)
class Base
include Concerns::Dependable
def initialize(model:, api_key: nil, **options)
@model = model
@api_key = api_key || api_key_fro... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/llm/open_router.rb | lib/regent/llm/open_router.rb | # frozen_string_literal: true
module Regent
class LLM
class OpenRouter < Base
ENV_KEY = "OPEN_ROUTER_API_KEY"
depends_on "open_router"
def invoke(messages, **args)
response = client.complete(
messages,
model: model,
extras: {
temperature: args... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/llm/gemini.rb | lib/regent/llm/gemini.rb | # frozen_string_literal: true
module Regent
class LLM
class Gemini < Base
ENV_KEY = "GEMINI_API_KEY"
SERVICE = "generative-language-api"
depends_on "gemini-ai"
def invoke(messages, **args)
response = client.generate_content({
contents: format_messages(messages),
... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/llm/open_ai.rb | lib/regent/llm/open_ai.rb | # frozen_string_literal: true
module Regent
class LLM
class OpenAI < Base
ENV_KEY = "OPENAI_API_KEY"
depends_on "ruby-openai"
attr_reader :model
def invoke(messages, **args)
response = client.chat(parameters: {
messages: messages,
model: model,
tem... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/engine/base.rb | lib/regent/engine/base.rb | # frozen_string_literal: true
module Regent
module Engine
class Base
def initialize(context, llm, toolchain, session, max_iterations)
@context = context
@llm = llm
@toolchain = toolchain
@session = session
@max_iterations = max_iterations
end
attr_reader... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/engine/react.rb | lib/regent/engine/react.rb | # frozen_string_literal: true
module Regent
module Engine
class React < Base
SEQUENCES = {
answer: "Answer:",
action: "Action:",
observation: "Observation:",
stop: "PAUSE"
}.freeze
def reason(task)
session.exec(Span::Type::INPUT, top_level: true, message... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
alchaplinsky/regent | https://github.com/alchaplinsky/regent/blob/d3eb8ae6fa69455c527031759d59d2e57e453c89/lib/regent/engine/react/prompt_template.rb | lib/regent/engine/react/prompt_template.rb | # frozen_string_literal: true
module Regent
module Engine
class React
module PromptTemplate
def self.system_prompt(context = "", tool_list = "")
<<~PROMPT
## Instructions
#{context ? "Consider the following context: #{context}\n\n" : ""}
You are an AI a... | ruby | MIT | d3eb8ae6fa69455c527031759d59d2e57e453c89 | 2026-01-04T17:43:08.008306Z | false |
codelittinc/slacked | https://github.com/codelittinc/slacked/blob/1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f/spec/post_console_spec.rb | spec/post_console_spec.rb | require 'spec_helper'
describe ".env" do
let(:template_path) {
"lib/generators/slacked/install/templates/.env"
}
it 'should exist in install' do
expect(File).to be_file(template_path)
end
it 'should contain SLACK_WEBHOOK' do
expect(file).to include "SLACK_WEBHOOK"
end
it 'should contain SL... | ruby | MIT | 1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f | 2026-01-04T17:43:04.105056Z | false |
codelittinc/slacked | https://github.com/codelittinc/slacked/blob/1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f/spec/rails_spec.rb | spec/rails_spec.rb | require "spec_helper"
describe Slacked do
before do
run_simple <<-CMD
rails new example \
--skip-gemfile \
--skip-bundle \
--skip-keeps \
--skip-sprockets \
--skip-javascript \
--skip-test-unit \
--no-rc \
--quiet
CMD
cd("example")
... | ruby | MIT | 1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f | 2026-01-04T17:43:04.105056Z | false |
codelittinc/slacked | https://github.com/codelittinc/slacked/blob/1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f/spec/slack_post_spec.rb | spec/slack_post_spec.rb | require 'spec_helper'
describe Slacked do
let(:message) { 'Gothan is calling!' }
before(:each) {
ENV[Slacked::SLACK_WEBHOOK_URL_KEY] = 'slack.mywebhook.com'
}
context 'post' do
it 'returns false when message is blank' do
expect(Slacked.post('')).to be_falsey
end
it 'returns false when ... | ruby | MIT | 1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f | 2026-01-04T17:43:04.105056Z | false |
codelittinc/slacked | https://github.com/codelittinc/slacked/blob/1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f/spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'slacked'
Dir[File.expand_path("../support/*.rb", __FILE__)].each { |f| require f }
| ruby | MIT | 1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f | 2026-01-04T17:43:04.105056Z | false |
codelittinc/slacked | https://github.com/codelittinc/slacked/blob/1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f/spec/support/aruba.rb | spec/support/aruba.rb | require "aruba/api"
RSpec.configure do |config|
config.include(Aruba::Api)
config.before do
@aruba_timeout_seconds = 60
FileUtils.rm_rf(current_dir)
end
end
| ruby | MIT | 1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f | 2026-01-04T17:43:04.105056Z | false |
codelittinc/slacked | https://github.com/codelittinc/slacked/blob/1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f/lib/slacked.rb | lib/slacked.rb | require 'slack-notifier'
require 'dotenv'
Dotenv.load
mydir = File.expand_path(File.dirname(__FILE__))
Dir[mydir + '/slacked/*.rb'].each {|file| require file }
| ruby | MIT | 1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f | 2026-01-04T17:43:04.105056Z | false |
codelittinc/slacked | https://github.com/codelittinc/slacked/blob/1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f/lib/generators/slacked/install/install_generator.rb | lib/generators/slacked/install/install_generator.rb | module Slacked
module Generators
class InstallGenerator < ::Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
desc 'Copy a Slacked file to your appplication'
def create_configuration
file_name = '.env'
if !File.exist?(file_name)
copy_file... | ruby | MIT | 1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f | 2026-01-04T17:43:04.105056Z | false |
codelittinc/slacked | https://github.com/codelittinc/slacked/blob/1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f/lib/slacked/version.rb | lib/slacked/version.rb | module Slacked
VERSION = "0.9.2"
end
| ruby | MIT | 1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f | 2026-01-04T17:43:04.105056Z | false |
codelittinc/slacked | https://github.com/codelittinc/slacked/blob/1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f/lib/slacked/slack_post.rb | lib/slacked/slack_post.rb | module Slacked
SLACK_PROFILE_IMAGE=':robot_face:'
SLACK_WEBHOOK_URL_KEY = 'SLACK_WEBHOOK'
SLACK_DEFAULT_MESSAGE_KEY='SLACK_DEFAULT_MESSAGE'
SLACK_DEFAULT_CONFIG = {
icon_emoji: SLACK_PROFILE_IMAGE,
webhook_url: ENV[SLACK_WEBHOOK_URL_KEY]
}.freeze
class << self
def post message = ENV[SLACK_DEFAU... | ruby | MIT | 1e9827bf9c3c0474a931d9f16d0ec91b08a5ff4f | 2026-01-04T17:43:04.105056Z | false |
debugtalk/AppiumBooster | https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/start.rb | start.rb | # filename: start.rb
require 'optparse'
require_relative 'lib/requires'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: start.rb [options]"
opts.on("-p <value>", "--app_path", "Specify app path") do |v|
options[:app_path] = v
end
options[:app_type] = "ios"
opts.on("-t <value>", "--app_t... | ruby | MIT | 808b04ea0ec046b6cf59f8b0b07e195764eb58c0 | 2026-01-04T17:42:57.924826Z | false |
debugtalk/AppiumBooster | https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/requires.rb | lib/requires.rb | # filename: lib/requires.rb
# require config helper
require_relative 'helpers/config_helper.rb'
# require the ios page checker
require_relative 'pages/inner_screen'
# require control helper
require_relative 'pages/control'
# require environment initializer
require_relative 'helpers/env_helper'
# setup driver
requi... | ruby | MIT | 808b04ea0ec046b6cf59f8b0b07e195764eb58c0 | 2026-01-04T17:42:57.924826Z | false |
debugtalk/AppiumBooster | https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/runner.rb | lib/runner.rb | # filename: lib/runner.rb
require "pathname"
def run_test(options)
app_path = options[:app_path]
app_type = options[:app_type]
testcase_file = options[:testcase_file]
$appium_driver = AppiumDriver.new options
capability = $appium_driver.get_capability
capability[:caps][:app] = app_path if app_path
if a... | ruby | MIT | 808b04ea0ec046b6cf59f8b0b07e195764eb58c0 | 2026-01-04T17:42:57.924826Z | false |
debugtalk/AppiumBooster | https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/testcase_helper.rb | lib/helpers/testcase_helper.rb | # filename: lib/helpers/testcase_helper.rb
require_relative 'utils'
require_relative 'yaml_helper'
require_relative 'csv_helper'
def exec_feature_step(control_id, control_action, data, step_optional=nil)
""" execute feature step.
"""
begin
if control_id.nil? or control_id.to_s == "N/A"
# this type of ... | ruby | MIT | 808b04ea0ec046b6cf59f8b0b07e195764eb58c0 | 2026-01-04T17:42:57.924826Z | false |
debugtalk/AppiumBooster | https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/csv_helper.rb | lib/helpers/csv_helper.rb | # filename: lib/helpers/csv_helper.rb
require 'csv'
def load_testcase_csv_file(testcase_csv_file_path)
""" load csv format testcase file.
output testcase_hash format example: {
'testcase_name': 'Login and Logout',
'features_suite': [
{
'feature_name': 'login with valid account',
'fea... | ruby | MIT | 808b04ea0ec046b6cf59f8b0b07e195764eb58c0 | 2026-01-04T17:42:57.924826Z | false |
debugtalk/AppiumBooster | https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/logger_helper.rb | lib/helpers/logger_helper.rb | # filename: lib/helpers/logger_helper.rb
require 'logger'
def initialize_logger(log_save_dir)
log_save_path = File.join(log_save_dir, "appium_booster.log")
$LOG = Logger.new("| tee #{log_save_path}")
$LOG.level = Logger::INFO
$LOG.formatter = proc do |severity, datetime, progname, msg|
datetime_format = ... | ruby | MIT | 808b04ea0ec046b6cf59f8b0b07e195764eb58c0 | 2026-01-04T17:42:57.924826Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.