[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8033":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":16,"starSnapshotCount":16,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},8033,"rbs","ruby\u002Frbs","ruby","The type signature language for Ruby","",null,"Ruby",2162,245,59,135,0,1,3,16,4,64.27,"Other",false,"master",true,[7,27],"type-checking","2026-06-12 04:00:37","# RBS\n\nRBS is a language to describe the structure of Ruby programs.\nYou can write down the definition of a class or module: methods defined in the class, instance variables and their types, and inheritance\u002Fmix-in relations.\nIt also allows declaring constants and global variables.\n\nThe following is a small example of RBS for a chat app.\n\n\u003C!-- run-start:a.rbs:bundle exec rbs -I a.rbs validate -->\n```rbs\nmodule ChatApp\n  VERSION: String\n\n  class User\n    attr_reader login: String\n    attr_reader email: String\n\n    def initialize: (login: String, email: String) -> void\n  end\n\n  class Bot\n    attr_reader name: String\n    attr_reader email: String\n    attr_reader owner: User\n\n    def initialize: (name: String, owner: User) -> void\n  end\n\n  class Message\n    attr_reader id: String\n    attr_reader string: String\n    attr_reader from: User | Bot                     # `|` means union types: `#from` can be `User` or `Bot`\n    attr_reader reply_to: Message?                   # `?` means optional type: `#reply_to` can be `nil`\n\n    def initialize: (from: User | Bot, string: String) -> void\n\n    def reply: (from: User | Bot, string: String) -> Message\n  end\n\n  class Channel\n    attr_reader name: String\n    attr_reader messages: Array[Message]\n    attr_reader users: Array[User]\n    attr_reader bots: Array[Bot]\n\n    def initialize: (name: String) -> void\n\n    def each_member: () { (User | Bot) -> void } -> void  # `{` and `}` means block.\n                   | () -> Enumerator[User | Bot, void]   # Method can be overloaded.\n  end\nend\n```\n\u003C!-- run-end -->\n\n## The Target Version\n\n* The standard library signatures targets the latest release of Ruby. (`3.2` as of 2023.)\n* The library code targets non-EOL versions of Ruby. (`>= 3.0` as of 2023.)\n\n## Installation\n\nInstall the `rbs` gem. `$ gem install rbs` from the command line, or add a line in your `Gemfile`.\n\n```rb\ngem \"rbs\"\n```\n\n## CLI\n\nThe gem ships with the `rbs` command line tool to demonstrate what it can do and help develop RBS.\n\n```console\n$ rbs version\n$ rbs list\n$ rbs ancestors ::Object\n$ rbs methods ::Object\n$ rbs method Object then\n```\n\nAn end user of `rbs` will probably find `rbs prototype` the most useful. This command generates boilerplate signature declarations for ruby files. For example, say you have written the below ruby script.\n\n```ruby\n# person.rb\nclass Person\n  attr_reader :name\n  attr_reader :contacts\n\n  def initialize(name:)\n    @name = name\n    @contacts = []\n  end\n\n  def speak\n    \"I'm #{@name} and I love Ruby!\"\n  end\nend\n```\n\nRunning prototype on the above will automatically generate\n\n```console\n$ rbs prototype rb person.rb\nclass Person\n  @name: untyped\n\n  @contacts: untyped\n\n  attr_reader name: untyped\n\n  attr_reader contacts: untyped\n\n  def initialize: (name: untyped) -> void\n\n  def speak: () -> ::String\nend\n```\n\nIt prints signatures for all methods, classes, instance variables, and constants.\nThis is only a starting point, and you should edit the output to match your signature more accurately.\n\n`rbs prototype` offers three options.\n\n- `rb` generates from just the available Ruby code\n- `rbi` generates from Sorbet RBI\n- `runtime` generates from runtime API\n\n## Library\n\nThere are two important concepts, _environment_ and _definition_.\n\nAn _environment_ is a dictionary that keeps track of all declarations. What is the declaration associated with `String` class? An _environment_ will give you the answer.\n\nA _definition_ gives you the detail of the class. What is the type of the return value of `gsub` method of the `String` class? The _definition_ for `String` class knows the list of methods it provides and their types.\n\nThe following is a small code to retrieve the definition of the `String#gsub` method.\n\n\u003C!-- run-start:a.rb:bundle exec ruby a.rb -->\n```rb\nrequire \"rbs\"\n\nloader = RBS::EnvironmentLoader.new()\n\n# loader.add(path: Pathname(\"sig\"))   # Load .rbs files from `sig` directory\n# loader.add(library: \"logger\")       # Load logger library\n\nenvironment = RBS::Environment.from_loader(loader).resolve_type_names\n\n# ::String\nstring = RBS::TypeName.new(name: :String, namespace: RBS::Namespace.root)\n\n# Class declaration for ::String\ndecl = environment.class_decls[string]\n\n# Builder provides the translation from `declaration` to `definition`\nbuilder = RBS::DefinitionBuilder.new(env: environment)\n\n# Definition of instance of String\ninstance = builder.build_instance(string)\n\n# Print the types of `gsub` method:\nputs instance.methods[:gsub].method_types.join(\"\\n\")\n# Outputs =>\n#  (::Regexp | ::string pattern, ::string replacement) -> ::String\n#  (::Regexp | ::string pattern, ::Hash[::String, ::String] hash) -> ::String\n#  (::Regexp | ::string pattern) { (::String match) -> ::_ToS } -> ::String\n#  (::Regexp | ::string pattern) -> ::Enumerator[::String, self]\n\n# Definition of singleton of String\nsingleton = builder.build_singleton(string)\n# No `gsub` method for String singleton\nputs singleton.methods[:gsub]\n```\n\u003C!-- run-end -->\n\n## Guides\n\n- [Architecture](docs\u002Farchitecture.md)\n- [Core and standard library signature contribution guide](docs\u002FCONTRIBUTING.md)\n- [Writing signatures guide](docs\u002Fsigs.md)\n- [Stdlib signatures guide](docs\u002Fstdlib.md)\n- [Syntax](docs\u002Fsyntax.md)\n- [RBS by Example](docs\u002Frbs_by_example.md)\n- [RBS collection](docs\u002Fcollection.md)\n- [Using `Data` and `Struct`](docs\u002Fdata_and_struct.md)\n- [Releasing a gem with RBS](docs\u002Fgem.md)\n\n## Community\n\nHere is a list of some places you can talk with active maintainers.\n\n- [Ruby Discord Server (invite link)](https:\u002F\u002Fdiscord.gg\u002Fad2acQFtkh) -- We have `rbs` channel in Ruby Discord server.\n- [ruby-jp Slack Workspace (in Japanese)](https:\u002F\u002Fruby-jp.github.io\u002F) -- We have `types` channel in ruby-jp slack workspace.\n- [gem_rbs_collection](https:\u002F\u002Fgithub.com\u002Fruby\u002Fgem_rbs_collection) -- We have a repository of third-party RBS type definitions, for the case your dependency doesn't ship with RBS files.\n\n## Development\n\nAfter checking out the repo, run `bin\u002Fsetup` to install dependencies. Then, run `bundle exec rake test` to run the tests. You can also run `bin\u002Fconsole` 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 tags, and push the `.gem` file to [rubygems.org](https:\u002F\u002Frubygems.org).\n\n### C Code Formatting\n\nThis project uses `clang-format` to enforce consistent formatting of C code with a `.clang-format` configuration in the root directory.\n\n#### Setup\n\nFirst, install clang-format:\n\n```bash\n# macOS\nbrew install clang-format\n\n# Ubuntu\u002FDebian\nsudo apt-get install clang-format\n\n# Windows\nchoco install llvm\n```\n\n#### Usage\n\nFormat all C source files:\n\n```bash\nrake format:c\n```\n\nCheck formatting without making changes:\n\n```bash\nrake format:c_check\n```\n\n#### Editor Integration\n\nFor VS Code users, install the \"clangd\" extension which will automatically use the project's `.clang-format` file.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https:\u002F\u002Fgithub.com\u002Fruby\u002Frbs.\n","RBS 是一种用于描述 Ruby 程序结构的类型签名语言。它允许用户定义类或模块的方法、实例变量及其类型以及继承\u002F混入关系，并支持声明常量和全局变量，从而帮助开发者更清晰地理解和维护代码。RBS 通过提供强大的类型检查功能来增强 Ruby 的静态分析能力，特别适用于需要提高代码质量和可维护性的大型项目或团队协作场景。此外，RBS 还配备了命令行工具，能够自动生成基本的类型签名，进一步简化了开发者的使用流程。",2,"2026-06-11 03:15:44","top_language"]