source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/shared_examples.rb | Ruby | apache-2.0 | 19 | master | 859 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_db_mysql_spec.rb | Ruby | apache-2.0 | 19 | master | 2,293 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_init_spec.rb | Ruby | apache-2.0 | 19 | master | 9,157 | require 'spec_helper'
describe 'barbican' do
shared_examples 'barbican' do
it { is_expected.to contain_class('barbican::deps') }
context 'with default parameters' do
let :params do
{}
end
it 'installs packages' do
is_expected.to contain_package('barbican').with(
... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_plugins_kmip_spec.rb | Ruby | apache-2.0 | 19 | master | 4,075 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_plugins_simple_crypto_spec.rb | Ruby | apache-2.0 | 19 | master | 2,825 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_plugins_dogtag_spec.rb | Ruby | apache-2.0 | 19 | master | 3,218 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_keystone_authtoken_spec.rb | Ruby | apache-2.0 | 19 | master | 7,934 | require 'spec_helper'
describe 'barbican::keystone::authtoken' do
let :params do
{ :password => 'barbican_password', }
end
shared_examples 'barbican::keystone::authtoken' do
context 'with default parameters' do
it 'configure keystone_authtoken' do
is_expected.to contain_keystone__resour... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_wsgi_apache_spec.rb | Ruby | apache-2.0 | 19 | master | 6,611 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_policy_spec.rb | Ruby | apache-2.0 | 19 | master | 2,692 | require 'spec_helper'
describe 'barbican::policy' do
shared_examples 'barbican::policy' do
context 'setup policy with parameters' do
let :params do
{
:enforce_scope => false,
:enforce_new_defaults => false,
:policy_path => '/etc/barbican/policy.yaml',
... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_api_logging_spec.rb | Ruby | apache-2.0 | 19 | master | 6,140 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_worker_spec.rb | Ruby | apache-2.0 | 19 | master | 3,032 | #
# Copyright (C) 2018 Binero
#
# Author: Tobias Urdin <tobias.urdin@binero.se>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_db_spec.rb | Ruby | apache-2.0 | 19 | master | 2,974 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_plugins_vault_spec.rb | Ruby | apache-2.0 | 19 | master | 4,439 | #
# Copyright (C) 2019 Matthew J. Black
#
# Author: Matthew J. Black <mjblack@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_keystone_auth_spec.rb | Ruby | apache-2.0 | 19 | master | 3,546 | #
# Unit tests for barbican::keystone::auth
#
require 'spec_helper'
describe 'barbican::keystone::auth' do
shared_examples_for 'barbican::keystone::auth' do
context 'with default class parameters' do
let :params do
{ :password => 'barbican_password' }
end
it { is_expected.to contain_k... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_keystone_notification_spec.rb | Ruby | apache-2.0 | 19 | master | 4,785 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_api_spec.rb | Ruby | apache-2.0 | 19 | master | 6,704 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_plugins_p11_crypto_spec.rb | Ruby | apache-2.0 | 19 | master | 5,922 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_db_sync_spec.rb | Ruby | apache-2.0 | 19 | master | 3,572 | require 'spec_helper'
describe 'barbican::db::sync' do
shared_examples_for 'barbican-dbsync' do
it { is_expected.to contain_class('barbican::deps') }
it 'runs barbican-manage db upgrade' do
is_expected.to contain_exec('barbican-db-manage').with(
:command => 'barbican-manage db upgrade ',... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_config_spec.rb | Ruby | apache-2.0 | 19 | master | 2,202 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_retry_scheduler_spec.rb | Ruby | apache-2.0 | 19 | master | 2,374 | require 'spec_helper'
describe 'barbican::retry_scheduler' do
let :params do
{}
end
shared_examples 'barbican::retry_scheduler' do
context 'with defaults' do
it 'configures retry scheduler parameters' do
is_expected.to contain_barbican_config('retry_scheduler/initial_delay_seconds')\
... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_db_postgresql_spec.rb | Ruby | apache-2.0 | 19 | master | 1,811 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_wsgi_uwsgi_spec.rb | Ruby | apache-2.0 | 19 | master | 835 | require 'spec_helper'
describe 'barbican::wsgi::uwsgi' do
shared_examples 'barbican::wsgi::uwsgi' do
context 'with default parameters' do
it {
should contain_class('barbican::deps')
}
it {
is_expected.to contain_barbican_api_uwsgi_config('uwsgi/processes').with_value(facts[:os... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_healthcheck_spec.rb | Ruby | apache-2.0 | 19 | master | 2,165 | require 'spec_helper'
describe 'barbican::healthcheck' do
shared_examples_for 'barbican::healthcheck' do
context 'with default parameters' do
let :params do
{}
end
it 'configures default values' do
is_expected.to contain_oslo__healthcheck('barbican_config').with(
:d... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_quota_spec.rb | Ruby | apache-2.0 | 19 | master | 2,195 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_cors_spec.rb | Ruby | apache-2.0 | 19 | master | 1,600 | require 'spec_helper'
describe 'barbican::cors' do
shared_examples_for 'barbican::cors' do
it 'configure cors default params' do
is_expected.to contain_oslo__cors('barbican_config').with(
:allowed_origin => '<SERVICE DEFAULT>',
:allow_credentials => '<SERVICE DEFAULT>',
:expose_... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_client_spec.rb | Ruby | apache-2.0 | 19 | master | 2,047 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/classes/barbican_audit_spec.rb | Ruby | apache-2.0 | 19 | master | 1,142 | require 'spec_helper'
describe 'barbican::audit' do
shared_examples_for 'barbican::audit' do
context 'with default parameters' do
let :params do
{}
end
it 'configures default values' do
is_expected.to contain_oslo__audit('barbican_config').with(
:audit_map_file => ... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/acceptance/99_barbican_config_spec.rb | Ruby | apache-2.0 | 19 | master | 2,837 | require 'spec_helper_acceptance'
describe 'basic barbican_config resource' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
Exec { logoutput => 'on_failure' }
File <||> -> Barbican_config <||>
File <||> -> Barbican_api_paste_ini <||>
file { '/etc/... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/acceptance/10_basic_barbican_spec.rb | Ruby | apache-2.0 | 19 | master | 2,341 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/unit/type/barbican_config_spec.rb | Ruby | apache-2.0 | 19 | master | 2,064 | require 'puppet'
require 'puppet/type/barbican_config'
describe 'Puppet::Type.type(:barbican_config)' do
before :each do
@barbican_config = Puppet::Type.type(:barbican_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should require a name' do
expect {
Puppet::Type.type(:barbican_config... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/unit/type/barbican_api_uwsgi_config_spec.rb | Ruby | apache-2.0 | 19 | master | 2,259 | require 'puppet'
require 'puppet/type/barbican_api_uwsgi_config'
describe 'Puppet::Type.type(:barbican_api_uwsgi_config)' do
before :each do
@barbican_api_uwsgi_config = Puppet::Type.type(:barbican_api_uwsgi_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should require a name' do
expect {
... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/unit/type/barbican_api_paste_ini_spec.rb | Ruby | apache-2.0 | 19 | master | 1,564 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/unit/provider/barbican_api_uwsgi_config/ini_setting_spec.rb | Ruby | apache-2.0 | 19 | master | 1,415 | require 'spec_helper'
provider_class = Puppet::Type.type(:barbican_api_uwsgi_config).provider(:ini_setting)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Barbican_api_uwsgi_config.new(
{:name => 'DEFAULT/foo', :value => 'bar... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/unit/provider/barbican_api_paste_ini/ini_setting_spec.rb | Ruby | apache-2.0 | 19 | master | 2,106 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | openstack/puppet-barbican | https://github.com/openstack/puppet-barbican | spec/unit/provider/barbican_config/openstackconfig_spec.rb | Ruby | apache-2.0 | 19 | master | 2,337 | #
# Copyright (C) 2016 Red Hat Inc. <licensing@redhat.com>
#
# Author: Ade Lee <alee@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | Rakefile | Ruby | mit | 20 | main | 394 | # frozen_string_literal: true
require "bundler/gem_tasks"
require "minitest/test_task"
Minitest::TestTask.create do |t|
t.test_globs = ["test/**/*_test.rb"]
end
require "standard/rake"
desc "Run tapioca compilers"
task :tapioca do
sh "bin/tapioca gem"
end
desc "Run Sorbet typechecker"
task :sorbet do
sh "bun... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | sorbet-schema.gemspec | Ruby | mit | 20 | main | 1,517 | # frozen_string_literal: true
require_relative "lib/sorbet-schema/version"
Gem::Specification.new do |spec|
spec.name = "sorbet-schema"
spec.version = SorbetSchema::VERSION
spec.authors = ["Max VelDink"]
spec.email = ["maxveldink@gmail.com"]
spec.summary = "Serialization and deserialization library into So... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | Gemfile | Ruby | mit | 20 | main | 528 | # frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in sorbet-schema.gemspec
gemspec
group :development do
gem "benchmark-ips"
gem "rake"
gem "standard"
gem "standard-performance"
gem "standard-sorbet"
gem "sorbet"
gem "tapioca", "~> 0.16.6", require: false
end... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | sorbet/tapioca/require.rb | Ruby | mit | 20 | main | 272 | # typed: true
# frozen_string_literal: true
require "debug"
require "json"
require "minitest/autorun"
require "minitest/reporters"
require "minitest/result_assertions"
require "sorbet-result"
require "sorbet-runtime"
require "sorbet-struct-comparable"
require "zeitwerk" |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | benchmarks/helpers.rb | Ruby | mit | 20 | main | 7,178 | # typed: strict
# frozen_string_literal: true
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "json"
require "sorbet-schema"
module BenchmarkHelpers
extend T::Sig
class Rank < T::Enum
enums do
Ace = new("Ace")
King = new("King")
Queen = new("Queen")
Jack = new("Jack")... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | benchmarks/simple_serialization.rb | Ruby | mit | 20 | main | 670 | # typed: strict
# frozen_string_literal: true
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "benchmark/ips"
require_relative "helpers"
game_schema = Typed::Schema.from_struct(BenchmarkHelpers::Game)
game_data = BenchmarkHelpers.game_data
game_struct = game_schema.from_hash(game_data).payload
hash_... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | benchmarks/many_fields_deserialization.rb | Ruby | mit | 20 | main | 583 | # typed: strict
# frozen_string_literal: true
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "benchmark/ips"
require_relative "helpers"
humongous_schema = Typed::Schema.from_struct(BenchmarkHelpers::Humongous)
humongous_data = BenchmarkHelpers.humongous_data
humongous_json = JSON.generate(humongous_... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | benchmarks/simple_deserialization.rb | Ruby | mit | 20 | main | 513 | # typed: strict
# frozen_string_literal: true
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "benchmark/ips"
require_relative "helpers"
game_schema = Typed::Schema.from_struct(BenchmarkHelpers::Game)
game_data = BenchmarkHelpers.game_data
game_json = JSON.generate(game_data)
Benchmark.ips do |x|
... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | benchmarks/many_fields_serialization.rb | Ruby | mit | 20 | main | 745 | # typed: strict
# frozen_string_literal: true
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "benchmark/ips"
require_relative "helpers"
humongous_schema = Typed::Schema.from_struct(BenchmarkHelpers::Humongous)
humongous_data = BenchmarkHelpers.humongous_data
humongous_struct = humongous_schema.from_... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/test_helper.rb | Ruby | mit | 20 | main | 346 | # typed: strict
# frozen_string_literal: true
require "minitest/autorun"
require "minitest/focus"
require "minitest/reporters"
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(color: true)]
require "minitest/result_assertions"
require "debug"
require "sorbet-schema"
Dir["test/support/**/*.rb"].eac... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/hash_transformer_test.rb | Ruby | mit | 20 | main | 1,378 | # typed: true
require "test_helper"
class HashTransformerTest < Minitest::Test
def setup
@test_hash = {
"test" => TestEnums::EnumOne,
:another => 1,
:deeper => {
:anotherhash => 2,
"deeperagain" => {
"value" => TestEnums::EnumThree,
"boolean" => false,
... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/serialize_value_test.rb | Ruby | mit | 20 | main | 851 | # typed: true
require "test_helper"
class SerializeValueTest < Minitest::Test
def test_when_value_is_a_hash_returns_each_value_serialized
assert_equal({:one => "1", "two" => "2"}, SerializeValue.serialize({:one => TestEnums::EnumOne, "two" => TestEnums::EnumTwo}))
end
def test_when_value_is_an_array_return... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/support/simple_string_coercer.rb | Ruby | mit | 20 | main | 490 | # typed: true
class SimpleStringCoercer < Typed::Coercion::Coercer
extend T::Generic
Target = type_member { {fixed: String} }
sig { override.params(type: T::Types::Base).returns(T::Boolean) }
def self.used_for_type?(type)
type == T::Utils.coerce(String)
end
sig { override.params(type: T::Types::Base... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/support/structs/job.rb | Ruby | mit | 20 | main | 816 | # typed: true
require "date"
require_relative "money"
class Job < T::Struct
include ActsAsComparable
const :title, String
const :salary, Money
const :start_date, T.nilable(Date)
const :needs_credential, T::Boolean, default: false
end
JOB_SCHEMA_WITH_INLINE_SERIALIZER = Typed::Schema.new(
target: Job,
... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/support/structs/person.rb | Ruby | mit | 20 | main | 478 | # typed: true
require_relative "job"
require_relative "../enums/ruby_rank"
require_relative "../enums/diamond_rank"
class Person < T::Struct
include ActsAsComparable
const :name, String
const :age, Integer
const :stone_rank, T.any(RubyRank, DiamondRank)
const :job, T.nilable(Job)
end
MAX_PERSON = Person.n... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/support/structs/country.rb | Ruby | mit | 20 | main | 360 | # typed: true
require_relative "city"
class Country < T::Struct
include ActsAsComparable
const :name, String
const :cities, T::Array[City]
const :national_items, T::Hash[Symbol, String], default: {}
end
US_COUNTRY = Country.new(name: "US", cities: [NEW_YORK_CITY, DC_CITY], national_items: {bird: "bald eagle... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/support/structs/city.rb | Ruby | mit | 20 | main | 375 | # typed: true
class City < T::Struct
include ActsAsComparable
const :name, String
const :capital, T::Boolean
const :data, T.nilable(T::Hash[String, Integer])
end
NEW_YORK_CITY = City.new(name: "New York", capital: false)
DC_CITY = City.new(name: "DC", capital: true)
OVIEDO_CITY = City.new(name: "Oviedo", cap... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/t/struct_test.rb | Ruby | mit | 20 | main | 2,112 | # typed: true
class StructTest < Minitest::Test
def test_schema_can_be_derived_from_struct
expected_schema = Typed::Schema.new(
fields: [
Typed::Field.new(name: :name, type: String),
Typed::Field.new(name: :capital, type: T::Utils.coerce(T::Boolean)),
Typed::Field.new(name: :data, t... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/serialization_error_test.rb | Ruby | mit | 20 | main | 290 | # typed: true
class DeserializeErrorTest < Minitest::Test
def setup
@error = Typed::DeserializeError.new("Testing")
end
def to_h_works
assert_equal({error: "Testing"}, @error.to_h)
end
def to_json_works
assert_equal('{"error":"Testing"}', @error.to_json)
end
end |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/hash_serializer_test.rb | Ruby | mit | 20 | main | 7,889 | # typed: true
require "test_helper"
class HashSerializerTest < Minitest::Test
class StructWithBooleanDefaultSetToTrue < T::Struct
include ActsAsComparable
const :tired, T::Boolean, default: true
end
class StructWithBooleanDefaultSetToFalse < T::Struct
include ActsAsComparable
const :tired, T:... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion_test.rb | Ruby | mit | 20 | main | 875 | # typed: true
require "bigdecimal"
class CoercionTest < Minitest::Test
def teardown
Typed::Coercion::CoercerRegistry.instance.reset!
end
def test_new_coercers_can_be_registered
Typed::Coercion.register_coercer(SimpleStringCoercer)
assert_equal(SimpleStringCoercer, Typed::Coercion::CoercerRegistry.... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/field_test.rb | Ruby | mit | 20 | main | 4,782 | # typed: true
require "test_helper"
class FieldTest < Minitest::Test
def test_sets_values_correctly_for_required
field = Typed::Field.new(name: :required, type: String)
assert_equal(:required, field.name)
assert_equal(T::Utils.coerce(String), field.type)
assert(field.required)
assert_nil(field.... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/parse_error_test.rb | Ruby | mit | 20 | main | 239 | # typed: true
require "test_helper"
class ParseErrorTest < Minitest::Test
def test_message_is_formatted
assert_equal("max_markup could not be parsed. Check for typos.", Typed::ParseError.new(format: :max_markup).message)
end
end |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/json_serializer_test.rb | Ruby | mit | 20 | main | 4,361 | # typed: true
require "test_helper"
class JSONSerializerTest < Minitest::Test
def setup
@serializer = Typed::JSONSerializer.new(schema: Typed::Schema.from_struct(Person))
end
# Serialize Tests
def test_it_can_simple_serialize
result = @serializer.serialize(MAX_PERSON)
assert_success(result)
... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/schema_test.rb | Ruby | mit | 20 | main | 1,294 | # typed: true
class SchemaTest < Minitest::Test
def setup
@schema = Typed::Schema.new(
fields: [
Typed::Field.new(name: :name, type: String),
Typed::Field.new(name: :age, type: Integer),
Typed::Field.new(name: :stone_rank, type: T::Utils.coerce(T.any(RubyRank, DiamondRank))),
... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/validations/field_type_validator_test.rb | Ruby | mit | 20 | main | 2,310 | # typed: true
require "test_helper"
class FieldTypeValidatorTest < Minitest::Test
def setup
@validator = Typed::Validations::FieldTypeValidator.new
@required_field = Typed::Field.new(name: :im_required, type: String)
@optional_field = Typed::Field.new(name: :im_optional, type: String, default: "Fallback... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/validations/type_mismatch_error_test.rb | Ruby | mit | 20 | main | 346 | # typed: true
require "test_helper"
class TypeMismatchErrorTest < Minitest::Test
def test_formats_error_message
assert_equal("Invalid type given to im_required. Expected String, got Integer.", Typed::Validations::TypeMismatchError.new(field_name: :im_required, field_type: T::Utils.coerce(String), given_type: In... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/validations/multiple_validation_error_test.rb | Ruby | mit | 20 | main | 482 | # typed: true
require "test_helper"
class MultipleValidationErrorTest < Minitest::Test
def test_formats_error_message
error = Typed::Validations::MultipleValidationError.new(
errors: [
Typed::Validations::RequiredFieldError.new(field_name: :testing),
Typed::Validations::RequiredFieldError.... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/validations/validation_results_test.rb | Ruby | mit | 20 | main | 1,212 | # typed: true
require "test_helper"
class ValidationResultsTest < Minitest::Test
def setup
@success1 = Typed::Success.new(Typed::Validations::ValidatedValue.new(name: :test, value: "testing"))
@success2 = Typed::Success.new(Typed::Validations::ValidatedValue.new(name: :test_again, value: 1))
@error = Ty... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/validations/required_field_error_test.rb | Ruby | mit | 20 | main | 242 | # typed: true
require "test_helper"
class RequiredFieldErrorTest < Minitest::Test
def test_formats_error_message
assert_equal("testing is required.", Typed::Validations::RequiredFieldError.new(field_name: :testing).message)
end
end |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/enum_coercer_test.rb | Ruby | mit | 20 | main | 1,133 | # typed: true
class EnumCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::EnumCoercer.new
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(T::Utils.coerce(RubyRank)))
refute(@coercer.class.used_for_type?(T::Utils.coerce(T::Enum)))
refute(@coercer.class.used_... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/struct_coercer_test.rb | Ruby | mit | 20 | main | 3,248 | # typed: true
class StructCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::StructCoercer.new
@type = T::Utils.coerce(Job)
@type_with_nested_struct = T::Utils.coerce(Person)
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(@type))
refute(@coercer.class.u... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/symbol_coercer_test.rb | Ruby | mit | 20 | main | 921 | # typed: true
class SymbolCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::SymbolCoercer.new
@type = T::Utils.coerce(Symbol)
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(@type))
refute(@coercer.class.used_for_type?(T::Utils.coerce(Integer)))
end
de... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/boolean_coercer_test.rb | Ruby | mit | 20 | main | 1,500 | # typed: true
class BooleanCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::BooleanCoercer.new
@type = T::Utils.coerce(T::Boolean)
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(@type))
refute(@coercer.class.used_for_type?(T::Utils.coerce(Integer)))
end... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/string_coercer_test.rb | Ruby | mit | 20 | main | 746 | # typed: true
class StringCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::StringCoercer.new
@type = T::Utils.coerce(String)
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(@type))
refute(@coercer.class.used_for_type?(T::Utils.coerce(Integer)))
end
de... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/float_coercer_test.rb | Ruby | mit | 20 | main | 1,065 | # typed: true
class FloatCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::FloatCoercer.new
@type = T::Utils.coerce(Float)
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(@type))
refute(@coercer.class.used_for_type?(T::Utils.coerce(Integer)))
end
def t... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/date_coercer_test.rb | Ruby | mit | 20 | main | 1,240 | # typed: true
require "test_helper"
class DateCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::DateCoercer.new
@type = T::Utils.coerce(Date)
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(@type))
refute(@coercer.class.used_for_type?(T::Utils.coerce(Integ... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/coercer_registry_test.rb | Ruby | mit | 20 | main | 607 | # typed: true
require "date"
class CoercerRegistryTest < Minitest::Test
def teardown
Typed::Coercion::CoercerRegistry.instance.reset!
end
def test_register_prepends_coercer_so_it_overrides_built_in_ones
Typed::Coercion::CoercerRegistry.instance.register(SimpleStringCoercer)
assert_equal(SimpleStri... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/integer_coercer_test.rb | Ruby | mit | 20 | main | 1,071 | # typed: true
class IntegerCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::IntegerCoercer.new
@type = T::Utils.coerce(Integer)
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(@type))
refute(@coercer.class.used_for_type?(T::Utils.coerce(Float)))
end
d... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/typed_hash_coercer_test.rb | Ruby | mit | 20 | main | 1,927 | # typed: true
require "test_helper"
class TypedHashCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::TypedHashCoercer.new
@type = T::Utils.coerce(T::Hash[String, Integer])
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(T::Utils.coerce(T::Hash[String, Integer]... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/typed_array_coercer_test.rb | Ruby | mit | 20 | main | 2,003 | # typed: true
class TypedArrayCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::TypedArrayCoercer.new
@type = T::Utils.coerce(T::Array[City])
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(T::Utils.coerce(T::Array[City])))
assert(@coercer.class.used_for_ty... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/coercion_not_supported_error_test.rb | Ruby | mit | 20 | main | 293 | # typed: true
require "test_helper"
class CoercionNotSupportedErrorTest < Minitest::Test
def test_formats_message
error = Typed::Coercion::CoercionNotSupportedError.new(type: T::Utils.coerce(RubyRank))
assert_equal("Coercer not found for type RubyRank.", error.message)
end
end |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | test/typed/coercion/date_time_coercer_test.rb | Ruby | mit | 20 | main | 1,310 | # typed: true
require "test_helper"
class DateTimeCoercerTest < Minitest::Test
def setup
@coercer = Typed::Coercion::DateTimeCoercer.new
@type = T::Utils.coerce(DateTime)
end
def test_used_for_type_works
assert(@coercer.class.used_for_type?(@type))
refute(@coercer.class.used_for_type?(T::Utils.... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/sorbet-schema.rb | Ruby | mit | 20 | main | 1,068 | # typed: strict
# frozen_string_literal: true
require "sorbet-runtime"
require "sorbet-result"
require "sorbet-struct-comparable"
# We can't use `Loader.for_gem` here as we've unconventionally named the root file.
require "zeitwerk"
loader = Zeitwerk::Loader.new
loader.push_dir(__dir__.to_s)
loader.ignore(__FILE__)
l... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/sorbet-schema/serialize_value.rb | Ruby | mit | 20 | main | 506 | # typed: strict
class SerializeValue
extend T::Sig
sig { params(value: T.untyped).returns(T.untyped) }
def self.serialize(value)
if value.is_a?(Hash)
HashTransformer.serialize_values(value)
elsif value.is_a?(Array)
value.map { |item| serialize(item) }
elsif value.is_a?(T::Struct)
v... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/sorbet-schema/hash_transformer.rb | Ruby | mit | 20 | main | 787 | # typed: strict
# We don't want a dependency on ActiveSupport.
# This is a simplified version of ActiveSupport's Key Hash extension
# https://github.com/rails/rails/blob/main/activesupport/lib/active_support/core_ext/hash/keys.rb
class HashTransformer
class << self
extend T::Sig
sig { params(hash: T::Hash[T... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/sorbet-schema/t/struct.rb | Ruby | mit | 20 | main | 736 | # typed: true
module T
class Struct
class << self
def schema
Typed::Schema.from_struct(self)
end
def serializer(type, options: {})
case type
when :hash
Typed::HashSerializer.new(**T.unsafe({schema:, **options}))
when :json
Typed::JSONSerializ... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/serializer.rb | Ruby | mit | 20 | main | 3,746 | # typed: strict
module Typed
class Serializer
extend T::Sig
extend T::Helpers
extend T::Generic
abstract!
Input = type_member
Output = type_member
Params = T.type_alias { T::Hash[Symbol, T.untyped] }
DeserializeResult = T.type_alias { Result[T::Struct, DeserializeError] }
sig { ... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/coercion.rb | Ruby | mit | 20 | main | 570 | # typed: strict
module Typed
module Coercion
extend T::Sig
sig { params(coercer: T.class_of(Coercer)).void }
def self.register_coercer(coercer)
CoercerRegistry.instance.register(coercer)
end
sig { type_parameters(:U).params(type: T::Types::Base, value: Value).returns(Result[Value, Coercio... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/parse_error.rb | Ruby | mit | 20 | main | 236 | # typed: strict
module Typed
class ParseError < DeserializeError
extend T::Sig
sig { params(format: Symbol).void }
def initialize(format:)
super("#{format} could not be parsed. Check for typos.")
end
end
end |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/serialization_error.rb | Ruby | mit | 20 | main | 325 | # typed: strict
module Typed
class SerializationError < StandardError
extend T::Sig
sig { returns({error: String}) }
def to_h
{error: message}
end
sig { params(_options: T::Hash[T.untyped, T.untyped]).returns(String) }
def to_json(_options = {})
JSON.generate(to_h)
end
end... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/hash_serializer.rb | Ruby | mit | 20 | main | 1,110 | # typed: strict
module Typed
class HashSerializer < Serializer
InputHash = T.type_alias { T::Hash[T.any(Symbol, String), T.untyped] }
Input = type_member { {fixed: InputHash} }
Output = type_member { {fixed: Params} }
sig { returns(T::Boolean) }
attr_reader :should_serialize_values
sig { pa... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/deserialize_error.rb | Ruby | mit | 20 | main | 328 | # typed: strict
module Typed
class DeserializeError < SerializationError
extend T::Sig
sig { returns({error: String}) }
def to_h
{error: message}
end
sig { params(_options: T::Hash[T.untyped, T.untyped]).returns(String) }
def to_json(_options = {})
JSON.generate(to_h)
end
... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/field.rb | Ruby | mit | 20 | main | 2,498 | # typed: strict
module Typed
class Field
extend T::Sig
InlineSerializer = T.type_alias { T.proc.params(arg0: T.untyped).returns(T.untyped) }
sig { returns(Symbol) }
attr_reader :name
sig { returns(T::Types::Base) }
attr_reader :type
sig { returns(T.untyped) }
attr_reader :default
... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/json_serializer.rb | Ruby | mit | 20 | main | 1,013 | # typed: strict
require "json"
module Typed
class JSONSerializer < Serializer
Input = type_member { {fixed: String} }
Output = type_member { {fixed: String} }
sig { override.params(source: Input).returns(Result[T::Struct, DeserializeError]) }
def deserialize(source)
parsed_json = JSON.parse(s... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/schema.rb | Ruby | mit | 20 | main | 1,796 | # typed: strict
module Typed
class Schema < T::Struct
extend T::Sig
include ActsAsComparable
const :fields, T::Array[Field], default: []
const :target, T.class_of(T::Struct)
sig { params(struct: T.class_of(T::Struct)).returns(Typed::Schema) }
def self.from_struct(struct)
Typed::Schema... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/validations.rb | Ruby | mit | 20 | main | 203 | # typed: strict
module Typed
module Validations
ValidationResult = T.type_alias { Result[ValidatedValue, ValidationError] }
ValidatedParams = T.type_alias { T::Hash[Symbol, Value] }
end
end |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/validations/multiple_validation_error.rb | Ruby | mit | 20 | main | 376 | # typed: strict
module Typed
module Validations
class MultipleValidationError < ValidationError
extend T::Sig
sig { params(errors: T::Array[ValidationError]).void }
def initialize(errors:)
combined_message = errors.map(&:message).join(" | ")
super("Multiple validation errors f... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/validations/field_type_validator.rb | Ruby | mit | 20 | main | 898 | # typed: strict
module Typed
module Validations
class FieldTypeValidator
extend T::Sig
include FieldValidator
sig { override.params(field: Field, value: Value).returns(ValidationResult) }
def validate(field:, value:)
if field.works_with?(value)
Success.new(ValidatedVal... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/validations/type_mismatch_error.rb | Ruby | mit | 20 | main | 411 | # typed: strict
module Typed
module Validations
class TypeMismatchError < ValidationError
extend T::Sig
sig { params(field_name: Symbol, field_type: T::Types::Base, given_type: T::Class[T.anything]).void }
def initialize(field_name:, field_type:, given_type:)
super("Invalid type given ... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/validations/required_field_error.rb | Ruby | mit | 20 | main | 271 | # typed: strict
module Typed
module Validations
class RequiredFieldError < ValidationError
extend T::Sig
sig { params(field_name: Symbol).void }
def initialize(field_name:)
super("#{field_name} is required.")
end
end
end
end |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/validations/field_validator.rb | Ruby | mit | 20 | main | 286 | # typed: strict
module Typed
module Validations
module FieldValidator
extend T::Sig
extend T::Helpers
interface!
sig { abstract.params(field: Field, value: Value).returns(ValidationResult) }
def validate(field:, value:)
end
end
end
end |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/validations/validation_results.rb | Ruby | mit | 20 | main | 762 | # typed: strict
module Typed
module Validations
class ValidationResults < T::Struct
extend T::Sig
const :results, T::Array[ValidationResult]
sig { returns(Result[ValidatedParams, ValidationError]) }
def combine
failing_results = results.select(&:failure?)
case failing_r... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/coercion/integer_coercer.rb | Ruby | mit | 20 | main | 754 | # typed: strict
module Typed
module Coercion
class IntegerCoercer < Coercer
extend T::Generic
Target = type_member { {fixed: Integer} }
sig { override.params(type: T::Types::Base).returns(T::Boolean) }
def self.used_for_type?(type)
type == T::Utils.coerce(Integer)
end
... |
github | maxveldink/sorbet-schema | https://github.com/maxveldink/sorbet-schema | lib/typed/coercion/coercion_not_supported_error.rb | Ruby | mit | 20 | main | 278 | # typed: strict
module Typed
module Coercion
class CoercionNotSupportedError < CoercionError
extend T::Sig
sig { params(type: T::Types::Base).void }
def initialize(type:)
super("Coercer not found for type #{type}.")
end
end
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.