• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

classjohn/ruby_koans_korean: Ruby Koans 한글화

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

classjohn/ruby_koans_korean

开源软件地址:

https://github.com/classjohn/ruby_koans_korean

开源编程语言:

Ruby 100.0%

开源软件介绍:

Neo Ruby Koans (Neo 루비 선문답)

The Ruby Koans(선문답)은 Ruby를 배우기 위한 깨달음의 길을 걷게 합니다. Ruby 언어, 문법, 구조, 그리고 몇 가지 함수와 라이브러리들을 배우는 것이 목표입니다. Koans는 또한 테스팅 기반으로 하는 문화를 가르쳐줍니다. 테스팅은 우리가 말로만 하는 것이 아닌, 우리 삶입니다. 테스팅은 루비의 위대한 것들을 배우기 위한 여정에 필수적입니다.

구조

Koans는 다양한 영역들이 파일로 구분되어 있습니다. 해쉬(hash)는 about_hashes.rb 에서, 모듈(module) about_modules.rb, etc. 그것들은 순서대로 path_to_enlightenment.rb 파일에 나열되어 있습니다.

각각의 koan은 루비에 대한 여러분의 지식을 증진 시키고, 그것을 바탕으로 쌓입니다. 프로그램은 수정이 첫번째 곳에서 멈춥니다.

Some koans simply need to have the correct answer substituted for an incorrect one. Some, however, require you to supply your own answer. If you see the method __ (a double underscore) listed, it is a hint to you to supply your own code in order to make it work correctly.

Installing Ruby

If you do not have Ruby setup, please visit ruby-lang.org/en/downloads/ for operating specific instructions. In order to run the koans you need ruby and rake installed. To check your installations simply type:

*nix platforms from any terminal window:

[~] $ ruby --version
[~] $ rake --version

Windows from the command prompt (cmd.exe)

c:\ruby --version
c:\rake --version

If you don't have rake installed, just run gem install rake

Any response for Ruby with a version number greater than 1.8 is fine (should be around 1.8.6 or more). Any version of rake will do.

Generating the Koans

A fresh checkout will not include the koans, you will need to generate them.

[ruby_koans] $ rake gen                       # generates the koans directory

If you need to regenerate the koans, thus wiping your current `koans`,

[ruby_koans] $ rake regen                     # regenerates the koans directory, wiping the original

The Path To Enlightenment

You can run the tests through rake or by calling the file itself (rake is the recommended way to run them as we might build more functionality into this task).

*nix platforms, from the ruby_koans directory

[ruby_koans] $ rake                           # runs the default target :walk_the_path
[ruby_koans] $ ruby path_to_enlightenment.rb  # simply call the file directly

Windows is the same thing

c:\ruby_koans\rake                             # runs the default target :walk_the_path
c:\ruby_koans\ruby path_to_enlightenment.rb    # simply call the file directly

Red, Green, Refactor

In test-driven development the mantra has always been red, green, refactor. Write a failing test and run it (red), make the test pass (green), then look at the code and consider if you can make it any better (refactor).

While walking the path to Ruby enlightenment you will need to run the koan and see it fail (red), make the test pass (green), then take a moment and reflect upon the test to see what it is teaching you and improve the code to better communicate its intent (refactor).

The very first time you run the koans you will see the following output:

[ ruby_koans ] $ rake
(in /Users/person/dev/ruby_koans)
/usr/bin/ruby1.8 path_to_enlightenment.rb

AboutAsserts#test_assert_truth has damaged your karma.

The Master says:
You have not yet reached enlightenment.

The answers you seek...
<false> is not true.

Please meditate on the following code:
./about_asserts.rb:10:in `test_assert_truth'
path_to_enlightenment.rb:38:in `each_with_index'
path_to_enlightenment.rb:38

mountains are merely mountains
your path thus far [X_________________________________________________] 0/280

You have come to your first stage. Notice it is telling you where to look for the first solution:

Please meditate on the following code:
./about_asserts.rb:10:in `test_assert_truth'
path_to_enlightenment.rb:38:in `each_with_index'
path_to_enlightenment.rb:38

Open the about_asserts.rb file and look at the first test:

# We shall contemplate truth by testing reality, via asserts.
def test_assert_truth
  assert false                # This should be true
end

Change the false to true and re-run the test. After you are done, think about what you are learning. In this case, ignore everything except the method name (test_assert_truth) and the parts inside the method (everything before the end).

In this case the goal is for you to see that if you pass a value to the assert method, it will either ensure it is true and continue on, or fail if the statement is false.

Running the Koans automatically

This section is optional.

Normally the path to enlightenment looks like this:

cd ruby_koans
rake
# edit
rake
# edit
rake
# etc

If you prefer, you can keep the koans running in the background so that after you make a change in your editor, the koans will immediately run again. This will hopefully keep your focus on learning Ruby instead of on the command line.

Install the Ruby gem (library) called watchr and then ask it to “watch” the koans for changes:

cd ruby_koans
rake
# decide to run rake automatically from now on as you edit
gem install watchr
watchr ./koans/koans.watchr

Inspiration

A special thanks to Mike Clark and Ara Howard for inspiring this project. Mike Clark wrote an excellent blog post about learning Ruby through unit testing. This sparked an idea that has taken a bit to solidify, that of bringing new rubyists into the community through testing. Ara Howard then gave us the idea for the Koans in his ruby quiz entry on Meta Koans (a must for any rubyist wanting to improve their skills). Also, “The Little Lisper” taught us all the value of the short questions/simple answers style of learning.

Mike Clark's post

www.clarkware.com/cgi/blosxom/2005/03/18

Meta Koans

rubyquiz.com/quiz67.html

The Little Lisper

www.amazon.com/Little-LISPer-Third-Daniel-Friedman/dp/0023397632

Other Resources

The Ruby Language

ruby-lang.org

Try Ruby in your browser

tryruby.org

Dave Thomas' introduction to Ruby Programming Ruby (the Pick Axe)

pragprog.com/titles/ruby/programming-ruby

Brian Marick's fantastic guide for beginners Everyday Scripting with Ruby

pragprog.com/titles/bmsft/everyday-scripting-with-ruby

Other stuff

번역

오창희 <[email protected]>

번역

강동주 <[email protected]>

Author

Jim Weirich <[email protected]>

Author

Joe O'Brien <[email protected]>

Issue Tracker

www.pivotaltracker.com/projects/48111

Requires

Ruby 1.8.x or later and Rake (any recent version)

License

RubyKoans is released under a Creative Commons, Attribution-NonCommercial-ShareAlike, Version 3.0 (creativecommons.org/licenses/by-nc-sa/3.0/) License.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap