# Exercism Ruby Track
[![Configlet Status][configlet-workflow-badge]][configlet-workflow]
[![Exercise Test Status][tests-workflow-badge]][tests-workflow]
Exercism Exercises in Ruby
## Table of Contents
- [Setup][#setup]
- [Anatomy of an Exercise][#anatomy-of-an-exercise]
- [Canonical Data][#canonical-data]
- [Running the Tests][#running-the-tests]
- [Pull Requests][#pull-requests]
- [Style Guide][#style-guide]
- [READMEs][#readmes]
- [Contributing Guide][#contributing-guide]
- [Ruby icon][#ruby-icon]
## Setup
You'll need a recent (2.6+) version of Ruby, but that's it.
Minitest ships with the language, so you're all set.
## Anatomy of an Exercise
The files for an exercise live in `exercises/<slug>`.
The slug for an exercise is a unique nickname composed of a-z (lowercase) and -, e.g. `clock` or `atbash-cipher`. Inside its directory, each exercise has:
* a test suite, `<exercise_name>_test.rb`
* an example solution, `.meta/solutions/<exercise_name>.rb`
where `<exercise_name>` is the underscored version of the exercise's slug, e.g., `clock` or `atbash_cipher`.
If the exercise has a test generator, the directory will also contain:
* the test generator, `.meta/generator/<exercise_name>_case.rb`
A few exercises use a custom test template:
* `.meta/generator/test_template.erb`
### Canonical Data
**Most exercises can be generated from shared inputs/outputs, called canonical data (see [Generated Test Suites][#generated-test-suites] below).** To find out whether a test has canonical data, check the [problem-specifications repo][canonical exercises].
## Running the Tests
Run the tests using `rake`, rather than `ruby path/to/the_test.rb`.
`rake` knows to look for the example solution and to disable skips.
Just tell `rake` the name of your problem and you are set:
```sh
rake test:clock
```
To pass arguments to the test command, like `-p` for example, you can run the
following:
```sh
rake test:clock -- -p
```
To run a subset of the tests, use a regular expression.
For example, if tests exist that are named identical_to_4_places, and identical, then we can run both tests with
```sh
rake test:hamming -- -p -n="/identical/"
```
Note that flags which have an attached value, like above, must take the form `-flag=value` and if `value` has spaces `-flag="value with spaces"`.
## Pull Requests
We welcome pull requests that provide fixes to existing test suites (missing tests, interesting edge cases, improved APIs), as well as new problems.
If you're unsure, then go ahead and open a GitHub issue, and we'll discuss the change.
Please submit changes to a single problem per pull request unless you're submitting a general change across many of the problems (e.g. formatting).
You can run (some) of the same checks that we run by running the following tool in your terminal:
bin/local-status-check
If you would like to have these run right before you push your commits, you can activate the hook by running this tool in your terminal:
bin/setup-git-hoooks
Thank you so much for contributing! :sparkles:
### Style Guide
We have created a minimal set of guidelines for the testing files, which you can take advantage of by installing the `rubocop` gem.
It will use the configuration file located in the root folder, `.rubocop.yml`.
When you edit your code, you can simply run `rubocop -D`.
It will ignore your example solution, but will gently suggest style for your test code.
The `-D` option that is suggested is provided to give you the ability to easily ignore the Cops that you think should be ignored.
This is easily done by doing `# rubocop:disable CopName`, where the `CopName` is replaced appropriately.
For more complete information, see [Rubocop][rubocop].
While `lib/generator/exercise_case.rb` provides helper functions as discussed above, it remains the responsibility of an exercise's generator to interpret its canonical-data.json data in a stylistically correct manner, e.g. converting string indices to integer indices.
## READMEs
All exercises must have a README.md file, but should not be created manually.
The READMEs are constructed using shared metadata, which lives in the [problem-specifications][] repo.
Use the `configlet` tool to generate a README from shared metadata:
1. Clone the [problem-specifications][] repo into an adjacent directory.
2. Fetch the configlet appropriate for your system: `bin/fetch-configlet`
3. Generate the readme for a particular exercise: `bin/configlet generate . --only rotational-cipher`
## Contributing Guide
If adding a new exercise:
* a [generator][#implementing-a-generator] should be implemented.
* a minimal, partial, solution should be able to be pushed, in order to create a WIP pull request.
For an in-depth discussion of how exercism language tracks and exercises work, please see the [contributing guide][contributing guide].
If you're just getting started and looking for a helpful way to get involved, take a look at [regenerating the test suites][#regenerating-a-test-suite], [porting an exercise from another language][port exercise], or [creating an automated test generator][#implementing-a-generator].
We are also available at our community forum: [building-exercism]
## Ruby icon
The Ruby icon is the Vienna.rb logo, and is used with permission. Thanks Floor
Dress :)
[#anatomy-of-an-exercise]: #anatomy-of-an-exercise
[assertion]: https://github.com/exercism/ruby/blob/master/lib/generator/exercise_case/assertion.rb
[building-exercism]: https://forum.exercism.org/c/general/building-exercism/125
[#canonical-data]: #canonical-data
[canonical data]: https://github.com/exercism/problem-specifications/tree/master/exercises
[canonical exercises]: https://github.com/exercism/problem-specifications/tree/master/exercises
[#changing-a-generated-exercise]: #changing-a-generated-exercise
[configlet-workflow-badge]: https://github.com/exercism/ruby/actions/workflows/configlet.yml/badge.svg
[configlet-workflow]: https://github.com/exercism/ruby/actions/workflows/configlet.yml
[configure the remote]: https://help.github.com/articles/configuring-a-remote-for-a-fork/
[#contributing-guide]: #contributing-guide
[contributing-guide]: https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data
[default template]: https://github.com/exercism/ruby/blob/master/lib/generator/test_template.erb
[exercism ruby]: https://github.com/exercism/ruby
[#generated-test-suites]: #generated-test-suites
[helper]: https://github.com/exercism/ruby/blob/master/lib/generator/exercise_case.rb
[#implementing-a-generator]: #implementing-a-generator
[port exercise]: https://github.com/exercism/docs/blob/master/you-can-help/implement-an-exercise-from-specification.md
[problem-specifications]: https://github.com/exercism/problem-specifications
[problem-specifications]: https://github.com/exercism/problem-specifications
[#pull-requests]: #pull-requests
[#readmes]: #readmes
[rebasing documentation]: https://help.github.com/articles/about-git-rebase/
[#regenerating-a-test-suite]: #regenerating-a-test-suite
[#regenerating-a-test-suite]: #regenerating-a-test-suite
[#ruby-icon]: #ruby-icon
[#running-the-tests]: #running-the-tests
[rubocop]: http://batsov.com/rubocop/
[#setup]: #setup
[#style-guide]: #style-guide
[synchronize]: https://help.github.com/articles/syncing-a-fork/
[tests-workflow-badge]: https://github.com/exercism/ruby/actions/workflows/exercise-tests.yml/badge.svg
[tests-workflow]: https://github.com/exercism/ruby/actions/workflows/exercise-tests.yml
没有合适的资源?快使用搜索试试~ 我知道了~
ruby使用案例红宝石
共969个文件
rb:415个
md:252个
json:172个
需积分: 1 0 下载量 131 浏览量
2024-02-24
21:32:19
上传
评论
收藏 733KB ZIP 举报
温馨提示
ruby使用案例红宝石
资源推荐
资源详情
资源评论
收起资源包目录
ruby使用案例红宝石 (969个子文件)
CODEOWNERS 199B
test_template.erb 380B
test_template.erb 379B
test_template.erb 328B
test_template.erb 323B
fetch-configlet 2KB
Gemfile 234B
.gitignore 84B
config.json 40KB
exercise-concepts.todo.json 10KB
canonical-data.json 1KB
config.json 1009B
config.json 908B
links.json 791B
links.json 791B
config.json 779B
config.json 778B
config.json 778B
config.json 770B
links.json 767B
config.json 753B
config.json 750B
config.json 729B
config.json 729B
config.json 725B
config.json 717B
config.json 694B
config.json 683B
config.json 681B
config.json 673B
config.json 669B
config.json 662B
config.json 658B
config.json 656B
config.json 656B
config.json 655B
config.json 652B
config.json 647B
config.json 646B
config.json 644B
config.json 638B
config.json 631B
config.json 630B
config.json 630B
config.json 630B
config.json 623B
config.json 619B
config.json 618B
config.json 612B
config.json 611B
config.json 609B
config.json 608B
config.json 608B
config.json 606B
config.json 605B
config.json 602B
config.json 602B
config.json 599B
config.json 596B
config.json 595B
config.json 592B
config.json 591B
config.json 590B
config.json 589B
config.json 586B
config.json 586B
config.json 585B
config.json 584B
config.json 583B
config.json 579B
config.json 578B
config.json 573B
config.json 570B
config.json 569B
config.json 565B
config.json 564B
config.json 564B
config.json 562B
config.json 557B
config.json 553B
config.json 546B
config.json 542B
config.json 541B
config.json 540B
config.json 540B
config.json 537B
config.json 535B
config.json 533B
config.json 531B
config.json 527B
config.json 525B
config.json 524B
config.json 514B
config.json 513B
config.json 511B
config.json 506B
config.json 505B
config.json 504B
config.json 497B
config.json 494B
共 969 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
AaronWang94
- 粉丝: 1716
- 资源: 311
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 7777端口抓包数据集
- IMG_0694.GIF
- 基于图像的三维模型重建C++源代码+文档说明(高分课程设计)
- 基于聚焦法的工件立体测量方案,根据数据进行三维重建 使用HALCON处理图像,MATLAB拟合数据+源代码+数据集+效果图
- 锄战三国村 修改:货币使用不减 v1.10(2) 原创 (中文).apk
- 基于python实现的单目双目视觉三维重建+源代码+图像图片(高分课程设计)
- 基于C+++OPENCV的全景图像拼接源码(课程设计)
- 基于Python+OpenCV对多张图片进行全景图像拼接,消除鬼影,消除裂缝+源代码+文档说明+界面截图(高分课程设计)
- 基于C++实现的全景图像拼接源码(课程设计)
- 基于SIFT特征点提取和RASIC算法实现全景图像拼接python源码+文档说明+界面截图+详细注释(95分以上课程大作业)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功