{"id":13878068,"url":"https://github.com/marcoroth/type_fusion","last_synced_at":"2025-07-22T22:06:03.629Z","repository":{"id":188088999,"uuid":"677544802","full_name":"marcoroth/type_fusion","owner":"marcoroth","description":"Collaborative Ruby type sampling","archived":false,"fork":false,"pushed_at":"2024-12-04T00:27:53.000Z","size":119,"stargazers_count":17,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-04T13:35:18.508Z","etag":null,"topics":["rbi","rbs","ruby","ruby-types","sorbet","types","typing"],"latest_commit_sha":null,"homepage":"https://gem.sh/types","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcoroth.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"marcoroth"}},"created_at":"2023-08-11T21:25:11.000Z","updated_at":"2025-02-10T10:41:29.000Z","dependencies_parsed_at":"2023-08-13T18:47:24.053Z","dependency_job_id":"61a98d4b-89ea-4bba-8509-21e07da0c896","html_url":"https://github.com/marcoroth/type_fusion","commit_stats":{"total_commits":83,"total_committers":2,"mean_commits":41.5,"dds":0.4457831325301205,"last_synced_commit":"2c9aecfe18c142fa10bb55ce165672a5240556b0"},"previous_names":["marcoroth/type_fusion"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/marcoroth/type_fusion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Ftype_fusion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Ftype_fusion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Ftype_fusion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Ftype_fusion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcoroth","download_url":"https://codeload.github.com/marcoroth/type_fusion/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcoroth%2Ftype_fusion/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265742885,"owners_count":23820925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rbi","rbs","ruby","ruby-types","sorbet","types","typing"],"created_at":"2024-08-06T08:01:38.954Z","updated_at":"2025-07-22T22:06:03.607Z","avatar_url":"https://github.com/marcoroth.png","language":"Ruby","readme":"# TypeFusion\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n```shell\nbundle add type_fusion\n```\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n```shell\ngem install type_fusion\n```\n\n### Running TypeFusion in the `test` environment\n\nSetup TypeFusion if you only want to run TypeFusion as part of your test suite.\n\n#### Minitest\n\nYou can require `type_fusion/minitest` in your `test_helper.rb`:\n\n```diff\n# test/test_helper.rb\n\nENV[\"RAILS_ENV\"] ||= \"test\"\nrequire_relative \"../config/environment\"\nrequire \"rails/test_help\"\n\n+require \"type_fusion/minitest\"\n\nclass ActiveSupport::TestCase\n  # ...\nend\n```\n\n#### RSpec\n\nYou can require `type_fusion/rspec` in your `spec_helper.rb`:\n\n```diff\n# spec/spec_helper.rb\n\n+require \"type_fusion/rspec\"\n\nRSpec.configure do |config|\n  # ...\nend\n```\n\n### Running TypeFusion in `development` or `production`\n\n#### Rack\n\n```ruby\nrequire \"type_fusion/rack/middleware\"\n\nuse TypeFusion::Middleware\n```\n\n#### Rails\n\nAdding the gem to your applications Gemfile will automatically setup `type_fusion`.\n\n\n\n## Configuration\n\nSetup `TypeFusion` in an initializer\n\n```ruby\n# config/initializers/type_fusion.rb\n\nrequire \"type_fusion\"\n\nTypeFusion.config do |config|\n\n  # === application_name\n  #\n  # Set application_name to a string which is used to know where the samples\n  # came from. Set application_name to an empty string if you wish to not\n  # send the application name alongside the samples.\n  #\n  # Default: \"TypeFusion\"\n  # Default when using Rails: Rails.application.class.module_parent_name\n  #\n  # config.application_name = \"YourApplication\"\n\n\n  # === endpoint\n  #\n  # Set endpoint to an URL where TypeFusion should send the samples to.\n  #\n  # Default: \"https://gem.sh/api/v1/types/samples\"\n  #\n  # config.endpoint = \"https://your-domain.com/api/v1/types/samples\"\n\n\n  # === type_sample_request\n  #\n  # Set type_sample_request to a lambda which resolves to true/false\n  # to set if type sampling should be enabled for the whole rack request.\n  #\n  # Default: -\u003e(rack_env) { [true, false, false, false].sample }\n  #\n  # config.type_sample_request = -\u003e(rack_env) { [true, false, false, false].sample }\n\n\n  # === type_sample_tracepoint_path\n  #\n  # Set type_sample_tracepoint_path to a lambda which resolves\n  # to true/false to check if a tracepoint_path should be sampled\n  # or not.\n  #\n  # This can be useful when you want to only sample method calls for\n  # certain gems or want to exclude a gem from being sampled.\n  #\n  # Example:\n  # config.type_sample_tracepoint_path = -\u003e(tracepoint_path) {\n  #   return false if tracepoint_path.include?(\"activerecord\")\n  #   return false if tracepoint_path.include?(\"sprockets\")\n  #   return false if tracepoint_path.include?(\"some-private-gem\")\n  #\n  #   true\n  # }\n  #\n  # Default: -\u003e(tracepoint_path) { true }\n  #\n  # config.type_sample_tracepoint_path = -\u003e(tracepoint_path) { true }\n\n\n  # === type_sample_call_rate\n  #\n  # Set type_sample_call_rate to 1.0 to capture 100% of method calls\n  # within a rack request.\n  #\n  # Default: 0.001\n  #\n  # config.type_sample_call_rate = 0.001\nend\n```\n\n## Usage\n\n#### Type sample inside a block\n\n```ruby\nTypeFusion.with_sampling do\n  # run code you want to type sample here\nend\n```\n\n#### Type sample globally\n\n```ruby\nTypeFusion.start\n\n# run code you want to type sample here\n\nTypeFusion.stop\n```\n\n#### Retrieve the samples\n\n```ruby\nTypeFusion::Sampler.instance.samples\n# =\u003e [...]\n```\n\n```ruby\nTypeFusion::Sampler.instance.samples.first\n\n# =\u003e #\u003cstruct TypeFusion::SampleCall\n#      gem_name=\"nokogiri\"\n#      gem_version=\"1.15.4-x86_64-darwin\",\n#      receiver=\"Nokogiri\",\n#      method_name=:parse,\n#      application_name=\"TypeFusion\",\n#      location=\"/Users/marcoroth/.anyenv/envs/rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/nokogiri-1.15.4-x86_64-darwin/lib/nokogiri.rb:43\",\n#      type_fusion_version=\"0.0.4\",\n#      parameters=[\n#        [:string, :req, String],\n#        [:url, :opt, NilClass],\n#        [:encoding, :opt, NilClass],\n#        [:options, :opt, NilClass]\n#      ],\n#      return_value=\"Nokogiri::XML::Document\"\n#     \u003e\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/marcoroth/type_fusion. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/marcoroth/type_fusion/blob/main/CODE_OF_CONDUCT.md).\n\n## Code of Conduct\n\nEveryone interacting in the TypeFusion project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/marcoroth/type_fusion/blob/main/CODE_OF_CONDUCT.md).\n","funding_links":["https://github.com/sponsors/marcoroth"],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcoroth%2Ftype_fusion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcoroth%2Ftype_fusion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcoroth%2Ftype_fusion/lists"}