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 |
|---|---|---|---|---|---|---|---|---|
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/application.rb | test/dummy/config/application.rb | # frozen_string_literal: true
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
require 'upgrow'
module Dummy
class Application < Rails::Application
config.load_defaults(Ra... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/environment.rb | test/dummy/config/environment.rb | # frozen_string_literal: true
# Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/puma.rb | test/dummy/config/puma.rb | # frozen_string_literal: true
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minim... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/routes.rb | test/dummy/config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
resources :articles
root 'articles#index'
end
| ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/boot.rb | test/dummy/config/boot.rb | # frozen_string_literal: true
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
$LOAD_PATH.unshift(File.expand_path('../../../lib', __dir__))
| ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/initializers/content_security_policy.rb | test/dummy/config/initializers/content_security_policy.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.conten... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/initializers/filter_parameter_logging.rb | test/dummy/config/initializers/filter_parameter_logging.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]
| ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/initializers/application_controller_renderer.rb | test/dummy/config/initializers/application_controller_renderer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
| ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/initializers/wrap_parameters.rb | test/dummy/config/initializers/wrap_parameters.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to
# an empty array.
ActiveSupport.on_load(:action_co... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/initializers/inflections.rb | test/dummy/config/initializers/inflections.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflect... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/initializers/cookies_serializer.rb | test/dummy/config/initializers/cookies_serializer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/initializers/permissions_policy.rb | test/dummy/config/initializers/permissions_policy.rb | # frozen_string_literal: true
# Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.permissions_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb ... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/initializers/assets.rb | test/dummy/config/initializers/assets.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/initializers/backtrace_silencers.rb | test/dummy/config/initializers/backtrace_silencers.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish
# to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| /noisy_library/.match?(line) }
# You can also remove all the silencers... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/initializers/mime_types.rb | test/dummy/config/initializers/mime_types.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/environments/test.rb | test/dummy/config/environments/test.rb | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test ru... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/environments/development.rb | test/dummy/config/environments/development.rb | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
Rails.application.configure do
# Settings specified here will take precedence over those in
# config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/test/dummy/config/environments/production.rb | test/dummy/config/environments/production.rb | # frozen_string_literal: true
require 'active_support/core_ext/integer/time'
Rails.application.configure do
# Settings specified here will take precedence over those in
# config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads ... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/lib/upgrow.rb | lib/upgrow.rb | # frozen_string_literal: true
require 'active_model'
require_relative 'upgrow/action'
require_relative 'upgrow/immutable_struct'
require_relative 'upgrow/input'
require_relative 'upgrow/model'
require_relative 'upgrow/result'
# The gem's main namespace.
module Upgrow
end
| ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/lib/upgrow/result.rb | lib/upgrow/result.rb | # frozen_string_literal: true
module Upgrow
# Results are special Structs that are generated dynamically to accommodate a
# set of pre-defined members. Since different Actions might want to return
# zero to multiple values, they are always returned as members of a Result
# instance.
#
# Regardless of the va... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/lib/upgrow/input.rb | lib/upgrow/input.rb | # frozen_string_literal: true
module Upgrow
# Inputs are objects that represent user-entered data. They are populated with
# information that is available for modification, such as in HTML forms or in
# API payloads, and they are passed on to Repositories as arguments for
# persistence operations, as provided ... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/lib/upgrow/immutable_struct.rb | lib/upgrow/immutable_struct.rb | # frozen_string_literal: true
module Upgrow
# A read-only Struct. An Immutable Struct is initialized with its member
# values and subsequent state changes are not permitted.
class ImmutableStruct < Struct
class << self
# Creates a new Immutable Struct class with the given members.
#
# @param... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/lib/upgrow/model.rb | lib/upgrow/model.rb | # frozen_string_literal: true
module Upgrow
# Models are objects that represent core entities of the app’s business logic.
# These are usually persisted and can be fetched and created as needed. They
# have unique keys for identification (usually a numeric value), and, most
# importantly perhaps, they are immu... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
szTheory/upgrow | https://github.com/szTheory/upgrow/blob/d85320dda3ec569c7a722ccfb17aad857681a5fd/lib/upgrow/action.rb | lib/upgrow/action.rb | # frozen_string_literal: true
module Upgrow
# Actions represent the entry points to the app’s core logic. These objects
# coordinate workflows in order to get operations and activities done.
# Ultimately, Actions are the public interface of the app’s business layers.
#
# Rails controllers talk to the app’s i... | ruby | MIT | d85320dda3ec569c7a722ccfb17aad857681a5fd | 2026-01-04T17:42:37.636615Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../dummy/config/environment', __FILE__)
require 'rspec/rails'
require 'typed_params'
RSpec.configure do |config|
config.expect_with(:rspec) { _1.syntax = :expect }
config.disable_monkey_patching!
config.before :each do
@i... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params_spec.rb | spec/typed_params_spec.rb | # frozen_string_literal: true
require 'spec_helper'
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/app/jobs/application_job.rb | spec/dummy/app/jobs/application_job.rb | class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/app/helpers/application_helper.rb | spec/dummy/app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/app/controllers/application_controller.rb | spec/dummy/app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/app/models/User.rb | spec/dummy/app/models/User.rb | class User < ApplicationRecord
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/app/models/application_record.rb | spec/dummy/app/models/application_record.rb | class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/app/mailers/application_mailer.rb | spec/dummy/app/mailers/application_mailer.rb | class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
layout "mailer"
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/app/channels/application_cable/channel.rb | spec/dummy/app/channels/application_cable/channel.rb | module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/app/channels/application_cable/connection.rb | spec/dummy/app/channels/application_cable/connection.rb | module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/application.rb | spec/dummy/config/application.rb | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
require "typed_params"
module Dummy
class Application < Rails::Application
config.load_defaults Rails::VERSION::STRING.to_... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/environment.rb | spec/dummy/config/environment.rb | # Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/puma.rb | spec/dummy/config/puma.rb | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/routes.rb | spec/dummy/config/routes.rb | Rails.application.routes.draw do
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Defines the root path route ("/")
# root "articles#index"
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/boot.rb | spec/dummy/config/boot.rb | # Set up gems listed in the Gemfile.
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/initializers/content_security_policy.rb | spec/dummy/config/initializers/content_security_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/initializers/filter_parameter_logging.rb | spec/dummy/config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
Rails.application.config.filter_parameters += [
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/initializers/inflections.rb | spec/dummy/config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/initializers/permissions_policy.rb | spec/dummy/config/initializers/permissions_policy.rb | # Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.permissions_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb :none
# f.fullscreen :s... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/environments/test.rb | spec/dummy/config/environments/test.rb | require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data the... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/environments/development.rb | spec/dummy/config/environments/development.rb | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for developme... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/dummy/config/environments/production.rb | spec/dummy/config/environments/production.rb | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your applica... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/path_spec.rb | spec/typed_params/path_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Path do
let(:path) { TypedParams::Path.new(:foo, :bar_baz, 42, :qux, casing:) }
let(:casing) { TypedParams.config.path_transform }
it 'should support JSON pointer paths' do
expect(path.to_json_pointer).to eq '/foo/bar_baz/42/... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/validator_spec.rb | spec/typed_params/validator_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Validator do
let :schema do
TypedParams::Schema.new type: :hash do
param :foo, type: :hash do
param :bar, type: :array do
items type: :hash do
param :baz, type: :integer
end
end
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/transformer_spec.rb | spec/typed_params/transformer_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Transformer do
it 'should traverse params depth-first' do
schema = TypedParams::Schema.new(type: :hash) do
param :parent, type: :hash, transform: -> k, v { [:a, v[:b].to_i] } do
param :child, type: :hash, transform: ->... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/formatters_spec.rb | spec/typed_params/formatters_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Formatters do
after { TypedParams::Formatters.unregister(:test) }
describe '.register' do
it 'should register format' do
format = TypedParams::Formatters.register(:test,
transform: -> params { params },
)
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/types_spec.rb | spec/typed_params/types_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Types do
describe '.register' do
after { TypedParams::Types.unregister(:test) }
it 'should register nominal type' do
type = TypedParams::Types.register(:test,
match: -> v {},
)
expect(TypedParams::Typ... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/pipeline_spec.rb | spec/typed_params/pipeline_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Pipeline do
it 'should reduce the pipeline steps in order' do
pipeline = TypedParams::Pipeline.new
input = 1
pipeline << -> v { v += 1 }
pipeline << -> v { v -= 2 }
pipeline << -> v { v *= 3 }
output = pipel... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/processor_spec.rb | spec/typed_params/processor_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Processor do
it 'should coerce, validate and transform params and not raise' do
schema = TypedParams::Schema.new(type: :hash) { param :bin, type: :string, coerce: true, format: { with: /\A\d+\z/ }, transform: -> k, v { [k, v.to_i... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/configuration_spec.rb | spec/typed_params/configuration_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Configuration do
subject { TypedParams::Configuration.new }
describe '#ignore_nil_optionals=' do
it('should respond') { expect(subject).to respond_to :ignore_nil_optionals= }
end
describe '#ignore_nil_optionals' do
it('s... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/schema_spec.rb | spec/typed_params/schema_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Schema do
let :schema do
TypedParams::Schema.new type: :hash do
param :foo, type: :hash do
param :bar, type: :array do
items type: :hash do
param :baz, type: :integer
end
end
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/controller_spec.rb | spec/typed_params/controller_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Controller do
subject {
Class.new ActionController::Base do
@controller_name = 'users'
include TypedParams::Controller
end
}
it 'should not raise when included in Metal controller' do
expect { Class.new(Acti... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/mapper_spec.rb | spec/typed_params/mapper_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Mapper do
let :schema do
TypedParams::Schema.new type: :hash do
param :foo, type: :hash do
param :bar, type: :array do
items type: :hash do
param :baz, type: :integer
end
end
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/memoize_spec.rb | spec/typed_params/memoize_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Memoize do
describe '.memoize' do
it 'memoizes' do
a = Class.new {
include TypedParams::Memoize
memoize
def without_args = SecureRandom.hex
}.new
expect(a).to receive(:without_args).twice.... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/bouncer_spec.rb | spec/typed_params/bouncer_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Bouncer do
context 'with lenient schema' do
it 'should bounce params with :if guard' do
schema = TypedParams::Schema.new type: :hash, strict: false do
param :foo, type: :integer, if: :admin?
param :bar, type: :... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/coercer_spec.rb | spec/typed_params/coercer_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Coercer do
let :schema do
TypedParams::Schema.new type: :hash do
param :boolean, type: :boolean, coerce: true
param :string, type: :string, coerce: true
param :integer, type: :integer, coerce: true
param :flo... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/parameter_spec.rb | spec/typed_params/parameter_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Parameter do
let :schema do
TypedParams::Schema.new type: :hash do
param :foo, type: :hash do
param :bar, type: :array do
items type: :hash do
param :baz, type: :integer
end
end
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/parameterizer_spec.rb | spec/typed_params/parameterizer_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Parameterizer do
it 'should parameterize array' do
schema = TypedParams::Schema.new(type: :array) { items(type: :hash) { param(:key, type: :symbol) } }
paramz = TypedParams::Parameterizer.new(schema:)
params = [{ key: :foo }... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/transforms/noop_spec.rb | spec/typed_params/transforms/noop_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Transforms::Noop do
let(:transform) { TypedParams::Transforms::Noop.new }
it 'should be noop' do
k, v = transform.call('foo', 'bar')
expect(k).to be nil
expect(v).to be nil
end
end | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/transforms/key_casing_spec.rb | spec/typed_params/transforms/key_casing_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Transforms::KeyCasing do
let(:transform) { TypedParams::Transforms::KeyCasing.new(casing) }
let(:casing) { TypedParams.config.key_transform }
context 'with no key transform' do
%w[
foo_bar
foo-bar
FooBar
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/transforms/key_alias_spec.rb | spec/typed_params/transforms/key_alias_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Transforms::KeyAlias do
let(:transform) { TypedParams::Transforms::KeyAlias.new(:alias) }
it 'should rename key to the alias' do
k, v = transform.call(:foo, :bar)
expect(k).to eq :alias
expect(v).to be :bar
end
end | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/transforms/nilify_blanks_spec.rb | spec/typed_params/transforms/nilify_blanks_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Transforms::NilifyBlanks do
let(:transform) { TypedParams::Transforms::NilifyBlanks.new }
[
string: '',
array: [],
hash: {},
].each do |key, value|
it "should transform blank #{key} to nil" do
k, v = transform... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/types/type_spec.rb | spec/typed_params/types/type_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Types::Type do
let :type do
TypedParams::Types::Type.new(
type: :hash,
name: :object,
accepts_block: true,
scalar: false,
coerce: -> v { v.respond_to?(:to_h) ? v.to_h : {} },
match: -> v { v.is_a?... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/validations/length_spec.rb | spec/typed_params/validations/length_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Validations::Length do
let(:validation) { TypedParams::Validations::Length.new(options) }
let(:options) { nil }
context 'with minimum: option' do
let(:options) {{ minimum: 5 }}
it 'should succeed' do
expect { vali... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/validations/format_spec.rb | spec/typed_params/validations/format_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Validations::Format do
let(:validation) { TypedParams::Validations::Format.new(options) }
let(:options) { nil }
context 'with without: option' do
let(:options) {{ without: /foo/ }}
it 'should succeed' do
expect { ... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/validations/exclusion_spec.rb | spec/typed_params/validations/exclusion_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Validations::Exclusion do
let(:validation) { TypedParams::Validations::Exclusion.new(options) }
let(:options) { nil }
context 'with in: option' do
let(:options) {{ in: %w[a b c] }}
it 'should succeed' do
expect { ... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/validations/inclusion_spec.rb | spec/typed_params/validations/inclusion_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Validations::Inclusion do
let(:validation) { TypedParams::Validations::Inclusion.new(options) }
let(:options) { nil }
context 'with in: option' do
context 'with range' do
let(:options) {{ in: 0..9 }}
it 'should ... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/formatters/rails_spec.rb | spec/typed_params/formatters/rails_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Formatters::Rails do
let :controller do
Class.new(ActionController::Base) { @controller_name = 'users' }
end
let :schema do
TypedParams::Schema.new(type: :hash) do
format :rails
param :first_name, type: :string... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/spec/typed_params/formatters/jsonapi_spec.rb | spec/typed_params/formatters/jsonapi_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe TypedParams::Formatters::JSONAPI do
let :schema do
TypedParams::Schema.new(type: :hash) do
format :jsonapi
param :meta, type: :hash, allow_non_scalars: true, optional: true
param :data, type: :hash do
param :type, type... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params.rb | lib/typed_params.rb | # frozen_string_literal: true
require 'typed_params/bouncer'
require 'typed_params/coercer'
require 'typed_params/configuration'
require 'typed_params/controller'
require 'typed_params/formatters'
require 'typed_params/formatters/formatter'
require 'typed_params/formatters/jsonapi'
require 'typed_params/formatters/rai... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/transformer.rb | lib/typed_params/transformer.rb | # frozen_string_literal: true
require 'typed_params/mapper'
module TypedParams
class Transformer < Mapper
def call(params)
depth_first_map(params) do |param|
schema = param.schema
parent = param.parent
# Ignore nil optionals when config is enabled
unless schema.allow_nil?
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/path.rb | lib/typed_params/path.rb | # frozen_string_literal: true
module TypedParams
class Path
attr_reader :keys
def initialize(*keys, casing: TypedParams.config.path_transform)
@casing = casing
@keys = keys
end
def to_json_pointer = '/' + keys.map { transform_key(_1) }.join('/')
def to_dot_notation = keys.map { tr... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/memoize.rb | lib/typed_params/memoize.rb | # frozen_string_literal: true
module TypedParams
module Memoize
def self.included(klass) = klass.extend ClassMethods
module ClassMethods
cattr_accessor :memoize_queue, default: []
def memoize
if memoize_queue.include?(self)
memoize_queue.clear
raise RuntimeError, 'm... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/pipeline.rb | lib/typed_params/pipeline.rb | # frozen_string_literal: true
module TypedParams
class Pipeline
def initialize = @steps = []
def <<(step) = steps << step
def call(params) = steps.reduce(params) { |v, step| step.call(v) }
private
attr_reader :steps
end
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/version.rb | lib/typed_params/version.rb | # frozen_string_literal: true
module TypedParams
VERSION = '1.4.1'
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/namespaced_set.rb | lib/typed_params/namespaced_set.rb | # frozen_string_literal: true
module TypedParams
##
# NamespacedSet is a set of key-values that are namespaced by a class.
# What makes this special is that access supports class inheritance.
# For example, given a Parent class and a Child class that inherits
# from Parent, the Child namespace can access the... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/handler_set.rb | lib/typed_params/handler_set.rb | # frozen_string_literal: true
require 'typed_params/namespaced_set'
module TypedParams
class HandlerSet
attr_reader :deferred,
:params,
:query
def initialize
@deferred = []
@params = NamespacedSet.new
@query = NamespacedSet.new
end
def deferre... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/formatters.rb | lib/typed_params/formatters.rb | # frozen_string_literal: true
require 'typed_params/formatters/formatter'
module TypedParams
module Formatters
cattr_reader :formats, default: {}
def self.register(format, transform:, decorate: nil)
raise ArgumentError, "format is already registered: #{format.inspect}" if
formats.key?(format)... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/parameter.rb | lib/typed_params/parameter.rb | # frozen_string_literal: true
require 'typed_params/path'
module TypedParams
class Parameter
attr_accessor :key,
:value
attr_reader :schema,
:parent
def initialize(key:, value:, schema:, parent: nil)
@key = key
@value = value
@schema = schema
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/processor.rb | lib/typed_params/processor.rb | # frozen_string_literal: true
module TypedParams
class Processor
def initialize(schema:, controller: nil)
@controller = controller
@schema = schema
end
def call(value)
params = Parameterizer.new(schema:).call(value:)
pipeline = Pipeline.new
pipeline << Bouncer.new(co... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/configuration.rb | lib/typed_params/configuration.rb | # frozen_string_literal: true
module TypedParams
class Configuration
##
# ignore_nil_optionals defines how nil optionals are handled.
# When enabled, optional params that are nil will be dropped
# given the schema does not allow_nil. Essentially, they
# will be treated as if they weren't provided... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/handler.rb | lib/typed_params/handler.rb | # frozen_string_literal: true
module TypedParams
class Handler
attr_reader :for,
:action,
:schema,
:format
def initialize(for:, schema:, action: nil, format: nil)
@for = binding.local_variable_get(:for)
@schema = schema
@action = action
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/validator.rb | lib/typed_params/validator.rb | # frozen_string_literal: true
require 'typed_params/mapper'
module TypedParams
class Validator < Mapper
def call(params)
raise InvalidParameterError.new('is missing', path: schema.path, source: schema.source) if
params.nil? && schema.required?
depth_first_map(params) do |param|
sche... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/controller.rb | lib/typed_params/controller.rb | # frozen_string_literal: true
require 'typed_params/handler'
require 'typed_params/handler_set'
require 'typed_params/schema_set'
require 'typed_params/memoize'
module TypedParams
module Controller
extend ActiveSupport::Concern
included do
include Memoize
cattr_accessor :typed_handlers, defaul... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types.rb | lib/typed_params/types.rb | # frozen_string_literal: true
require 'typed_params/types/type'
module TypedParams
module Types
cattr_reader :registry, default: []
cattr_reader :abstracts, default: {}
cattr_reader :subtypes, default: {}
cattr_reader :types, default: {}
def self.register(type, match:, name: nil, coerce: ... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/schema_set.rb | lib/typed_params/schema_set.rb | # frozen_string_literal: true
require 'typed_params/namespaced_set'
module TypedParams
class SchemaSet < NamespacedSet; end
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/parameterizer.rb | lib/typed_params/parameterizer.rb | # frozen_string_literal: true
module TypedParams
class Parameterizer
def initialize(schema:, parent: nil)
@schema = schema
@parent = parent
end
def call(key: ROOT, value:)
return value if
value.is_a?(Parameter)
return nil if
key == ROOT &&
value.nil?
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/mapper.rb | lib/typed_params/mapper.rb | # frozen_string_literal: true
module TypedParams
class Mapper
def initialize(schema:, controller: nil)
@controller = controller
@schema = schema
end
def call(*, &) = raise NotImplementedError
def self.call(*args, **kwargs, &block)
new(**kwargs).call(*args, &block)
end
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/bouncer.rb | lib/typed_params/bouncer.rb | # frozen_string_literal: true
require 'typed_params/mapper'
module TypedParams
class Bouncer < Mapper
def call(params)
depth_first_map(params) do |param|
next unless
param.schema.if? || param.schema.unless?
cond = param.schema.if? ? param.schema.if : param.schema.unless
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/coercer.rb | lib/typed_params/coercer.rb | # frozen_string_literal: true
require 'typed_params/mapper'
module TypedParams
class Coercer < Mapper
def call(params)
depth_first_map(params) do |param|
schema = param.schema
next unless
schema.coerce?
param.value = schema.type.coerce(param.value)
rescue CoercionE... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/schema.rb | lib/typed_params/schema.rb | # frozen_string_literal: true
module TypedParams
class Schema
attr_reader :validations,
:transforms,
:formatter,
:parent,
:children,
:source,
:type,
:key,
:as,
:alias,
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/transforms/nilify_blanks.rb | lib/typed_params/transforms/nilify_blanks.rb | # frozen_string_literal: true
require 'typed_params/transforms/transform'
module TypedParams
module Transforms
class NilifyBlanks < Transform
def call(key, value)
return [key, value] if
value.is_a?(Array) || value.is_a?(Hash)
[key, value.blank? ? nil : value]
end
end
... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/transforms/noop.rb | lib/typed_params/transforms/noop.rb | # frozen_string_literal: true
require 'typed_params/transforms/transform'
module TypedParams
module Transforms
class Noop < Transform
def call(*) = []
end
end
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/transforms/transform.rb | lib/typed_params/transforms/transform.rb | # frozen_string_literal: true
module TypedParams
module Transforms
class Transform
def call(key, value) = raise NotImplementedError
def self.wrap(fn) = fn
end
end
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/transforms/key_alias.rb | lib/typed_params/transforms/key_alias.rb | # frozen_string_literal: true
require 'typed_params/transforms/transform'
module TypedParams
module Transforms
class KeyAlias < Transform
def initialize(as) = @as = as
def call(_, value) = [as, value]
private
attr_reader :as
end
end
end
| ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
keygen-sh/typed_params | https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/transforms/key_casing.rb | lib/typed_params/transforms/key_casing.rb | # frozen_string_literal: true
require 'typed_params/transforms/transform'
module TypedParams
module Transforms
class KeyCasing < Transform
def initialize(casing) = @casing = casing
def call(key, value)
transformed_key = transform_key(key)
transformed_value = transform_value(value)... | ruby | MIT | 168deb54e19dd0f8aea55e14f1821089cf8000b3 | 2026-01-04T17:42:43.396590Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.