Giter Site home page Giter Site logo

ruby_koans's Introduction

Ruby Koans

The Ruby Koans walk you along the path to enlightenment in order to learn Ruby. The goal is to learn the Ruby language, syntax, structure, and some common functions and libraries. We also teach you culture by basing the koans on tests. Testing is not just something we pay lip service to, but something we live. Testing is essential in your quest to learn and do great things in Ruby.

The Structure

The koans are broken out into areas by file, hashes are covered in about_hashes.rb, modules are introduced in about_modules.rb, etc. They are presented in order in the path_to_enlightenment.rb file.

Each koan builds up your knowledge of Ruby and builds upon itself. It will stop at the first place you need to correct.

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 (0%)

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 observr 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 observr
observr ./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

Author

Jim Weirich <[email protected]>

Author

Joe O’Brien <[email protected]>

Issue Tracker

github.com/edgecase/ruby_koans/issues

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.

ruby_koans's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ruby_koans's Issues

wrong directory for observr in Readme

In the readme it says:

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

Running it like that outside the koans directory will get a "No rakefile found" error, it should be run in the koans directory just as observr koans.watchr

Randomly fails with a segfault on mac with ruby 3.2.2

koans/neo.rb:122: [BUG] Segmentation fault at 0x0000000200000205
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0017 p:0012 s:0077 e:000073 METHOD /home/bento/ruby_koans/koans/neo.rb:122
c:0016 p:0010 s:0069 e:000068 METHOD /home/bento/ruby_koans/koans/neo.rb:115
c:0015 p:0007 s:0063 e:000062 METHOD (eval):1
c:0014 p:0058 s:0058 e:000056 METHOD /home/bento/ruby_koans/koans/neo.rb:244
c:0013 p:0008 s:0052 e:000051 BLOCK /home/bento/ruby_koans/koans/neo.rb:519
c:0012 p:0031 s:0048 e:000047 BLOCK /home/bento/ruby_koans/koans/neo.rb:530 [FINISH]
c:0011 p:---- s:0043 e:000042 CFUNC :each
c:0010 p:0007 s:0039 e:000038 BLOCK /home/bento/ruby_koans/koans/neo.rb:528 [FINISH]
c:0009 p:---- s:0034 e:000033 IFUNC
c:0008 p:---- s:0031 e:000030 CFUNC :each
c:0007 p:---- s:0028 e:000027 CFUNC :each_with_index
c:0006 p:0010 s:0024 e:000023 BLOCK /home/bento/ruby_koans/koans/neo.rb:527 [FINISH]
c:0005 p:---- s:0020 e:000019 CFUNC :catch
c:0004 p:0006 s:0015 e:000014 METHOD /home/bento/ruby_koans/koans/neo.rb:525
c:0003 p:0010 s:0011 e:000010 METHOD /home/bento/ruby_koans/koans/neo.rb:518
c:0002 p:0013 s:0006 e:000005 BLOCK /home/bento/ruby_koans/koans/neo.rb:540 [FINISH]
c:0001 p:0000 s:0003 E:0004d0 DUMMY [FINISH]

-- Ruby level backtrace information ----------------------------------------
/home/bento/ruby_koans/koans/neo.rb:540:in block in <top (required)>' /home/bento/ruby_koans/koans/neo.rb:518:in walk'
/home/bento/ruby_koans/koans/neo.rb:525:in each_step' /home/bento/ruby_koans/koans/neo.rb:525:in catch'
/home/bento/ruby_koans/koans/neo.rb:527:in block in each_step' /home/bento/ruby_koans/koans/neo.rb:527:in each_with_index'
/home/bento/ruby_koans/koans/neo.rb:527:in each' /home/bento/ruby_koans/koans/neo.rb:528:in block (2 levels) in each_step'
/home/bento/ruby_koans/koans/neo.rb:528:in each' /home/bento/ruby_koans/koans/neo.rb:530:in block (3 levels) in each_step'
/home/bento/ruby_koans/koans/neo.rb:519:in block in walk' /home/bento/ruby_koans/koans/neo.rb:244:in observe'
(eval):1:in green' /home/bento/ruby_koans/koans/neo.rb:115:in colorize'
/home/bento/ruby_koans/koans/neo.rb:122:in `color'

-- Machine register context ------------------------------------------------
RIP: 0x000055e7af9168ef RBP: 0x000055e7b08ad8e0 RSP: 0x00007fffbb45acf0
RAX: 0x0000000000000015 RBX: 0x000055e7b0512b38 RCX: 0x0000000200000205
RDX: 0x000000000000056c RDI: 0x000055e7b05127e0 RSI: 0x000000000000002c
R8: 0x0000000000000001 R9: 0x0000000000000020 R10: 0x00007f4211f8ffe8
R11: 0x000000000000000c R12: 0x000055e7b05127e0 R13: 0x000055e7b0512c30
R14: 0x00007fffbb45b060 R15: 0x0000000000000000 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_print_backtrace+0x11) [0x55e7afb0061d] vm_dump.c:785
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_vm_bugreport) vm_dump.c:1080
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_bug_for_fatal_signal+0xec) [0x55e7afbabfbc] error.c:813
/home/bento/.rbenv/versions/3.2.2/bin/ruby(sigsegv+0x4d) [0x55e7afa5111d] signal.c:964
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f42125f3420]
/home/bento/.rbenv/versions/3.2.2/bin/ruby(RVALUE_MARKED+0x34) [0x55e7af9168ef] gc.c:1656
/home/bento/.rbenv/versions/3.2.2/bin/ruby(gc_mark_set) gc.c:6930
/home/bento/.rbenv/versions/3.2.2/bin/ruby(gc_mark_ptr) gc.c:7044
/home/bento/.rbenv/versions/3.2.2/bin/ruby(gc_mark_children+0x817) [0x55e7af918597] gc.c:7317
/home/bento/.rbenv/versions/3.2.2/bin/ruby(gc_mark_stacked_objects+0xe) [0x55e7af919aa9] gc.c:7437
/home/bento/.rbenv/versions/3.2.2/bin/ruby(gc_mark_stacked_objects_all) gc.c:7477
/home/bento/.rbenv/versions/3.2.2/bin/ruby(gc_marks_rest) gc.c:8675
/home/bento/.rbenv/versions/3.2.2/bin/ruby(gc_marks+0x37) [0x55e7af91aa79] gc.c:8716
/home/bento/.rbenv/versions/3.2.2/bin/ruby(gc_start) gc.c:9547
/home/bento/.rbenv/versions/3.2.2/bin/ruby(heap_prepare+0x52) [0x55e7af91b653] gc.c:2431
/home/bento/.rbenv/versions/3.2.2/bin/ruby(heap_next_free_page) gc.c:2672
/home/bento/.rbenv/versions/3.2.2/bin/ruby(newobj_alloc) gc.c:2780
/home/bento/.rbenv/versions/3.2.2/bin/ruby(newobj_of0+0x64) [0x55e7af91e3b8] gc.c:2876
/home/bento/.rbenv/versions/3.2.2/bin/ruby(newobj_of) gc.c:2896
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_wb_protected_newobj_of) gc.c:2918
/home/bento/.rbenv/versions/3.2.2/bin/ruby(str_alloc_embed+0x12) [0x55e7afa6b27a] string.c:894
/home/bento/.rbenv/versions/3.2.2/bin/ruby(str_duplicate) string.c:1827
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_str_resurrect+0x5) [0x55e7afa7c59b] string.c:1843
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_str_concat_literals) string.c:3344
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_exec_core+0x2170) [0x55e7afaf4300] insns.def:405
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_vm_exec+0x640) [0x55e7afae2db0] vm.c:2383
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_yield+0x25e) [0x55e7afae7c2e] vm.c:1398
/home/bento/.rbenv/versions/3.2.2/bin/ruby(RB_FL_TEST_RAW+0x0) [0x55e7afb1195c] array.c:2740
/home/bento/.rbenv/versions/3.2.2/bin/ruby(RB_FL_ANY_RAW) ./include/ruby/internal/fl_type.h:552
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_array_len) ./include/ruby/internal/core/rarray.h:321
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_ary_each) array.c:2739
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_call_cfunc_with_frame+0x128) [0x55e7afad6158] vm_insnhelper.c:3268
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_sendish+0x0) [0x55e7afaf2439] vm_insnhelper.c:5080
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_exec_core) insns.def:801
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_vm_exec+0x18e) [0x55e7afae28fe] vm.c:2374
/home/bento/.rbenv/versions/3.2.2/bin/ruby(each_with_index_i+0x91) [0x55e7afb9b5b1] enum.c:2745
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_vm_pop_frame+0x0) [0x55e7afae0f82] vm_insnhelper.c:4288
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_yield_with_cfunc) vm_insnhelper.c:4289
/home/bento/.rbenv/versions/3.2.2/bin/ruby(invoke_block_from_c_bh+0x24) [0x55e7afae7d33] vm.c:1477
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_yield_with_cref) vm.c:1509
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_yield) vm.c:1517
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_yield_0) vm_eval.c:1348
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_yield) vm_eval.c:1364
/home/bento/.rbenv/versions/3.2.2/bin/ruby(RB_FL_TEST_RAW+0x0) [0x55e7afb1195c] array.c:2740
/home/bento/.rbenv/versions/3.2.2/bin/ruby(RB_FL_ANY_RAW) ./include/ruby/internal/fl_type.h:552
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_array_len) ./include/ruby/internal/core/rarray.h:321
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_ary_each) array.c:2739
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_cfp_consistent_p+0x0) [0x55e7afaea3ef] vm_eval.c:150
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_call0_cfunc_with_frame) vm_eval.c:152
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_call0_cfunc) vm_eval.c:164
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_call0_body) vm_eval.c:210
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_call0+0x223) [0x55e7afaed623] vm_eval.c:87
/home/bento/.rbenv/versions/3.2.2/bin/ruby(iterate_method+0x3b) [0x55e7afaee24b] vm_eval.c:877
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_iterate0+0x109) [0x55e7afadd619] vm_eval.c:1532
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_block_call+0x76) [0x55e7afadd986] vm_eval.c:1564
/home/bento/.rbenv/versions/3.2.2/bin/ruby(enum_each_with_index+0x4c) [0x55e7afb96dac] enum.c:2783
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_call_cfunc_with_frame+0x128) [0x55e7afad6158] vm_insnhelper.c:3268
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_call_method_each_type+0x79) [0x55e7afae39d9] vm_insnhelper.c:3920
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_call_method+0xc4) [0x55e7afae44e4] vm_insnhelper.c:4070
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_sendish+0x0) [0x55e7afaf2439] vm_insnhelper.c:5080
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_exec_core) insns.def:801
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_vm_exec+0x18e) [0x55e7afae28fe] vm.c:2374
/home/bento/.rbenv/versions/3.2.2/bin/ruby(catch_i+0x2c7) [0x55e7afae6c87] vm.c:1398
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_catch_protect+0xf2) [0x55e7afaddb42] vm_eval.c:2393
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_catch_obj+0x1f) [0x55e7afaddd94] vm_eval.c:2419
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_f_catch) vm_eval.c:2369
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_call_cfunc_with_frame+0x128) [0x55e7afad6158] vm_insnhelper.c:3268
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_call_method_each_type+0x79) [0x55e7afae39d9] vm_insnhelper.c:3920
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_call_method+0xc4) [0x55e7afae44e4] vm_insnhelper.c:4070
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_sendish+0x0) [0x55e7afaf2439] vm_insnhelper.c:5080
/home/bento/.rbenv/versions/3.2.2/bin/ruby(vm_exec_core) insns.def:801
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_vm_exec+0x18e) [0x55e7afae28fe] vm.c:2374
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_vm_invoke_proc+0x33) [0x55e7afaea223] vm.c:1603
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_proc_call_kw+0x28) [0x55e7af9e9815] proc.c:995
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_proc_call) proc.c:1005
/home/bento/.rbenv/versions/3.2.2/bin/ruby(exec_end_procs_chain+0x43) [0x55e7af8f467d] eval_jump.c:105
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_ec_exec_end_proc) eval_jump.c:120
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_ec_teardown+0xd5) [0x55e7af8f4895] eval.c:159
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_ec_cleanup+0x152) [0x55e7af8f4a92] eval.c:212
/home/bento/.rbenv/versions/3.2.2/bin/ruby(ruby_run_node+0x59) [0x55e7af8f5439] eval.c:330
/home/bento/.rbenv/versions/3.2.2/bin/ruby(rb_main+0x21) [0x55e7af8effc7] ./main.c:38
/home/bento/.rbenv/versions/3.2.2/bin/ruby(main) ./main.c:57
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f4212411083]
[0x55e7af8f001e]

-- Other runtime information -----------------------------------------------

  • Process memory map:

55e7af8bc000-55e7af8eb000 r--p 00000000 103:01 4976823 /home/bento/.rbenv/versions/3.2.2/bin/ruby
55e7af8eb000-55e7afbb8000 r-xp 0002f000 103:01 4976823 /home/bento/.rbenv/versions/3.2.2/bin/ruby
55e7afbb8000-55e7afcf0000 r--p 002fc000 103:01 4976823 /home/bento/.rbenv/versions/3.2.2/bin/ruby
55e7afcf0000-55e7afcfa000 r--p 00433000 103:01 4976823 /home/bento/.rbenv/versions/3.2.2/bin/ruby
55e7afcfa000-55e7afcfb000 rw-p 0043d000 103:01 4976823 /home/bento/.rbenv/versions/3.2.2/bin/ruby
55e7afcfb000-55e7afd0d000 rw-p 00000000 00:00 0
55e7b050e000-55e7b08d5000 rw-p 00000000 00:00 0 [heap]
7f420b12f000-7f420b31f000 r--s 00000000 103:01 4762 /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f420b31f000-7f420b346000 r--s 00000000 103:01 4821 /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f420b346000-7f420d74e000 r--s 00000000 103:01 4976823 /home/bento/.rbenv/versions/3.2.2/bin/ruby
7f420d74e000-7f420d751000 r--p 00000000 103:01 4842 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f420d751000-7f420d763000 r-xp 00003000 103:01 4842 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f420d763000-7f420d767000 r--p 00015000 103:01 4842 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f420d767000-7f420d768000 r--p 00018000 103:01 4842 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f420d768000-7f420d769000 rw-p 00019000 103:01 4842 /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
7f420d780000-7f420d9b0000 rw-p 00000000 00:00 0
7f420d9c0000-7f420da90000 rw-p 00000000 00:00 0
7f420da90000-7f420da91000 ---p 00000000 00:00 0
7f420da91000-7f420db32000 rw-p 00000000 00:00 0
7f420db32000-7f420db33000 ---p 00000000 00:00 0
7f420db33000-7f420dbd4000 rw-p 00000000 00:00 0
7f420dbd4000-7f420dbd5000 ---p 00000000 00:00 0
7f420dbd5000-7f420dc76000 rw-p 00000000 00:00 0
7f420dc76000-7f420dc77000 ---p 00000000 00:00 0
7f420dc77000-7f420dd18000 rw-p 00000000 00:00 0
7f420dd18000-7f420dd19000 ---p 00000000 00:00 0
7f420dd19000-7f420ddba000 rw-p 00000000 00:00 0
7f420ddba000-7f420ddbb000 ---p 00000000 00:00 0
7f420ddbb000-7f420de5c000 rw-p 00000000 00:00 0
7f420de5c000-7f420de5d000 ---p 00000000 00:00 0
7f420de5d000-7f420defe000 rw-p 00000000 00:00 0
7f420defe000-7f420deff000 ---p 00000000 00:00 0
7f420deff000-7f420dfa0000 rw-p 00000000 00:00 0
7f420dfa0000-7f420dfa1000 ---p 00000000 00:00 0
7f420dfa1000-7f420e042000 rw-p 00000000 00:00 0
7f420e042000-7f420e043000 ---p 00000000 00:00 0
7f420e043000-7f420e0e4000 rw-p 00000000 00:00 0
7f420e0e4000-7f420e0e5000 ---p 00000000 00:00 0
7f420e0e5000-7f420e186000 rw-p 00000000 00:00 0
7f420e186000-7f420e187000 ---p 00000000 00:00 0
7f420e187000-7f420e228000 rw-p 00000000 00:00 0
7f420e228000-7f420e229000 ---p 00000000 00:00 0
7f420e229000-7f420e2ca000 rw-p 00000000 00:00 0
7f420e2ca000-7f420e2cb000 ---p 00000000 00:00 0
7f420e2cb000-7f420e36c000 rw-p 00000000 00:00 0
7f420e36c000-7f420e36d000 ---p 00000000 00:00 0
7f420e36d000-7f420e40e000 rw-p 00000000 00:00 0
7f420e40e000-7f420e40f000 ---p 00000000 00:00 0
7f420e40f000-7f420e4b0000 rw-p 00000000 00:00 0
7f420e4b0000-7f420e4b1000 ---p 00000000 00:00 0
7f420e4b1000-7f420e552000 rw-p 00000000 00:00 0
7f420e552000-7f420e553000 ---p 00000000 00:00 0
7f420e553000-7f420e5f4000 rw-p 00000000 00:00 0
7f420e5f4000-7f420e5f5000 ---p 00000000 00:00 0
7f420e5f5000-7f420e696000 rw-p 00000000 00:00 0
7f420e696000-7f420e697000 ---p 00000000 00:00 0
7f420e697000-7f420e738000 rw-p 00000000 00:00 0
7f420e738000-7f420e739000 ---p 00000000 00:00 0
7f420e739000-7f420e7da000 rw-p 00000000 00:00 0
7f420e7da000-7f420e7db000 ---p 00000000 00:00 0
7f420e7db000-7f420e87c000 rw-p 00000000 00:00 0
7f420e87c000-7f420e87d000 ---p 00000000 00:00 0
7f420e87d000-7f420e91e000 rw-p 00000000 00:00 0
7f420e91e000-7f420e91f000 ---p 00000000 00:00 0
7f420e91f000-7f420e9c0000 rw-p 00000000 00:00 0
7f420e9c0000-7f420e9c1000 ---p 00000000 00:00 0
7f420e9c1000-7f420ea62000 rw-p 00000000 00:00 0
7f420ea62000-7f420ea63000 ---p 00000000 00:00 0
7f420ea63000-7f420eb04000 rw-p 00000000 00:00 0
7f420eb04000-7f420eb05000 ---p 00000000 00:00 0
7f420eb05000-7f420eba6000 rw-p 00000000 00:00 0
7f420eba6000-7f420eba7000 ---p 00000000 00:00 0
7f420eba7000-7f420ec48000 rw-p 00000000 00:00 0
7f420ec48000-7f420ec49000 ---p 00000000 00:00 0
7f420ec49000-7f420ecea000 rw-p 00000000 00:00 0
7f420ecea000-7f420eceb000 ---p 00000000 00:00 0
7f420eceb000-7f420ed8c000 rw-p 00000000 00:00 0
7f420ed8c000-7f420ed8d000 ---p 00000000 00:00 0
7f420ed8d000-7f420ee2e000 rw-p 00000000 00:00 0
7f420ee2e000-7f420ee2f000 ---p 00000000 00:00 0
7f420ee2f000-7f420ef00000 rw-p 00000000 00:00 0
7f420ef06000-7f4211fd0000 rw-p 00000000 00:00 0
7f4211fd2000-7f42120d3000 rw-p 00000000 00:00 0
7f42120d3000-7f4212105000 r--p 00000000 103:01 6156 /usr/lib/locale/C.UTF-8/LC_CTYPE
7f4212105000-7f42123eb000 r--p 00000000 103:01 6150 /usr/lib/locale/locale-archive
7f42123eb000-7f42123ed000 rw-p 00000000 00:00 0
7f42123ed000-7f421240f000 r--p 00000000 103:01 4762 /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f421240f000-7f4212587000 r-xp 00022000 103:01 4762 /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f4212587000-7f42125d5000 r--p 0019a000 103:01 4762 /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f42125d5000-7f42125d9000 r--p 001e7000 103:01 4762 /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f42125d9000-7f42125db000 rw-p 001eb000 103:01 4762 /usr/lib/x86_64-linux-gnu/libc-2.31.so
7f42125db000-7f42125df000 rw-p 00000000 00:00 0
7f42125df000-7f42125e5000 r--p 00000000 103:01 4821 /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f42125e5000-7f42125f6000 r-xp 00006000 103:01 4821 /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f42125f6000-7f42125fc000 r--p 00017000 103:01 4821 /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f42125fc000-7f42125fd000 r--p 0001c000 103:01 4821 /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f42125fd000-7f42125fe000 rw-p 0001d000 103:01 4821 /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
7f42125fe000-7f4212604000 rw-p 00000000 00:00 0
7f4212604000-7f4212611000 r--p 00000000 103:01 4764 /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f4212611000-7f42126b8000 r-xp 0000d000 103:01 4764 /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f42126b8000-7f4212751000 r--p 000b4000 103:01 4764 /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f4212751000-7f4212752000 r--p 0014c000 103:01 4764 /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f4212752000-7f4212753000 rw-p 0014d000 103:01 4764 /usr/lib/x86_64-linux-gnu/libm-2.31.so
7f4212753000-7f4212755000 r--p 00000000 103:01 3510 /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f4212755000-7f421276a000 r-xp 00002000 103:01 3510 /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f421276a000-7f4212784000 r--p 00017000 103:01 3510 /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f4212784000-7f4212785000 r--p 00030000 103:01 3510 /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f4212785000-7f4212786000 rw-p 00031000 103:01 3510 /usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
7f4212786000-7f421278e000 rw-p 00000000 00:00 0
7f421278e000-7f421278f000 r--p 00000000 103:01 4763 /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f421278f000-7f4212791000 r-xp 00001000 103:01 4763 /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f4212791000-7f4212792000 r--p 00003000 103:01 4763 /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f4212792000-7f4212793000 r--p 00003000 103:01 4763 /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f4212793000-7f4212794000 rw-p 00004000 103:01 4763 /usr/lib/x86_64-linux-gnu/libdl-2.31.so
7f4212794000-7f421279e000 r--p 00000000 103:01 3808 /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f421279e000-7f42127fe000 r-xp 0000a000 103:01 3808 /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f42127fe000-7f4212815000 r--p 0006a000 103:01 3808 /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f4212815000-7f4212816000 ---p 00081000 103:01 3808 /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f4212816000-7f4212817000 r--p 00081000 103:01 3808 /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f4212817000-7f4212818000 rw-p 00082000 103:01 3808 /usr/lib/x86_64-linux-gnu/libgmp.so.10.4.0
7f4212818000-7f421281a000 r--p 00000000 103:01 4844 /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f421281a000-7f421281e000 r-xp 00002000 103:01 4844 /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f421281e000-7f4212820000 r--p 00006000 103:01 4844 /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f4212820000-7f4212821000 r--p 00007000 103:01 4844 /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f4212821000-7f4212822000 rw-p 00008000 103:01 4844 /usr/lib/x86_64-linux-gnu/librt-2.31.so
7f4212822000-7f4212824000 r--p 00000000 103:01 3874 /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f4212824000-7f4212835000 r-xp 00002000 103:01 3874 /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f4212835000-7f421283b000 r--p 00013000 103:01 3874 /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f421283b000-7f421283c000 ---p 00019000 103:01 3874 /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f421283c000-7f421283d000 r--p 00019000 103:01 3874 /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f421283d000-7f421283e000 rw-p 0001a000 103:01 3874 /usr/lib/x86_64-linux-gnu/libz.so.1.2.11
7f421283e000-7f421283f000 r--p 00000000 103:01 4976912 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/monitor.so
7f421283f000-7f4212840000 r-xp 00001000 103:01 4976912 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/monitor.so
7f4212840000-7f4212841000 r--p 00002000 103:01 4976912 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/monitor.so
7f4212841000-7f4212842000 r--p 00002000 103:01 4976912 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/monitor.so
7f4212842000-7f4212843000 rw-p 00003000 103:01 4976912 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/monitor.so
7f4212843000-7f4212844000 r--p 00000000 103:01 4976861 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/enc/trans/transdb.so
7f4212844000-7f4212846000 r-xp 00001000 103:01 4976861 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/enc/trans/transdb.so
7f4212846000-7f4212847000 r--p 00003000 103:01 4976861 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/enc/trans/transdb.so
7f4212847000-7f4212848000 r--p 00003000 103:01 4976861 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/enc/trans/transdb.so
7f4212848000-7f4212849000 rw-p 00004000 103:01 4976861 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/enc/trans/transdb.so
7f4212849000-7f421284a000 r--p 00000000 103:01 4976879 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/enc/encdb.so
7f421284a000-7f421284b000 r-xp 00001000 103:01 4976879 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/enc/encdb.so
7f421284b000-7f421284c000 r--p 00002000 103:01 4976879 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/enc/encdb.so
7f421284c000-7f421284d000 r--p 00002000 103:01 4976879 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/enc/encdb.so
7f421284d000-7f421284e000 rw-p 00003000 103:01 4976879 /home/bento/.rbenv/versions/3.2.2/lib/ruby/3.2.0/x86_64-linux/enc/encdb.so
7f421284e000-7f4212855000 r--s 00000000 103:01 3794 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7f4212855000-7f4212857000 rw-p 00000000 00:00 0
7f4212857000-7f4212858000 r--p 00000000 103:01 4758 /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f4212858000-7f421287b000 r-xp 00001000 103:01 4758 /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f421287b000-7f4212883000 r--p 00024000 103:01 4758 /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f4212884000-7f4212885000 r--p 0002c000 103:01 4758 /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f4212885000-7f4212886000 rw-p 0002d000 103:01 4758 /usr/lib/x86_64-linux-gnu/ld-2.31.so
7f4212886000-7f4212887000 rw-p 00000000 00:00 0
7fffbac5f000-7fffbb45e000 rw-p 00000000 00:00 0 [stack]
7fffbb4f9000-7fffbb4fd000 r--p 00000000 00:00 0 [vvar]
7fffbb4fd000-7fffbb4ff000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]

The download link on rubykoans.com results in a different folder than cloning the repo

For example, the Rakefile in the rubykoans.com download is just this:

#!/usr/bin/env ruby
# -*- ruby -*-

require 'rake/clean'
require 'rake/testtask'

task :default => :test

task :test do
  ruby 'path_to_enlightenment.rb'
end

while the Rakefile in the repository is much longer.

rake gen and rake regen are not even supported by the rubykoans.com download, even though it's mentioned in the accompanying readme.

I'm getting a NoMethodError using Ruby version 3.2.0

When I switch to Ruby version 3.1.3 (the only other Ruby version on my system), then the Koans work as expected. So it appears this is only an issue with Ruby version 3.2.0

Here's the stack trace:

[beeburrt@fedora-machine koans]$ rake
/home/beeburrt/.asdf/installs/ruby/3.2.0/bin/ruby path_to_enlightenment.rb
/home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:221:in `add_progress': undefined method `exists?' for File:Class (NoMethodError)

      exists = File.exists?(PROGRESS_FILE_NAME)
                   ^^^^^^^^
Did you mean?  exist?
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:249:in `observe'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:519:in `block in walk'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:530:in `block (3 levels) in each_step'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:528:in `each'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:528:in `block (2 levels) in each_step'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:527:in `each'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:527:in `each_with_index'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:527:in `block in each_step'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:525:in `catch'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:525:in `each_step'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:518:in `walk'
	from /home/beeburrt/ruby_stuff/ruby_koans/koans/neo.rb:540:in `block in <top (required)>'
rake aborted!
Command failed with status (1): [/home/beeburrt/.asdf/installs/ruby/3.2.0/b...]
/home/beeburrt/ruby_stuff/ruby_koans/koans/Rakefile:10:in `block in <top (required)>'
Tasks: TOP => default => test
(See full trace by running task with --trace)

Unless I'm doing something wrong. Here's the steps I took:

  • Cloned this repo to my machine
  • cd'd into the ruby_koans directory
  • ran: rake gen
  • cd'd into the koans directory
  • then ran: rake (as you can see from the top of what I pasted in above)

I guess I can include --trace in the command? As it says at bottom there. Let me know if you want me to do that

Resolve segfault issue

Duplicated by #45, #43, and I think #40

I'm able to reproduce this pretty reliably. Going to mark the above issues as duplicates. Let me know if for some reason you think they are distinct.

Seems to happen when I run rake run, but not rake 🤔. Will have to dig in when I get some time (hoping this week since I'm off work for a few days).

Drop support for EOL rubies

Heh, there's some in_ruby_version checks of 1.8, 1.9.

On one hand, given the historical significance of the project, I kind of like them. However, they are a bit of a maintenance burden.

Perhaps they should just be honored in the git history :)

rubykoans.com 502

Website has gone 502!

Oh Noez.

If this requires patching, assistance, motivation, encouragement, enlightenment, whatever, ...

Ping me.

@pjfitzgibbons

Randomly fails on random file in ruby 3.2.2 on windows

I unzipped the download file, fixed the "exists -> exist" problem and ran rake. Running rake five times in a row has one work as expected. The others throw a seg fault from a random file (most often about_true_and_false) full output below. This random failing behavior also happened when following instructions in the main readme.

C:/Ruby32-x64/bin/ruby.exe path_to_enlightenment.rb
C:/Users/jlpeters/Documents/CodeLearning/ruby-koans/about_true_and_false.rb: [BUG] Segmentation fault
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]

-- Control frame information -----------------------------------------------
c:0007 p:---- s:0035 e:000034 CFUNC :method_missing
c:0006 p:---- s:0032 e:000031 CFUNC :set_encoding
c:0005 p:---- s:0029 e:000028 DUMMY [FINISH]
c:0004 p:---- s:0026 e:000025 CFUNC :require
c:0003 p:0107 s:0021 e:000020 METHOD internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:85
c:0002 p:0022 s:0006 e:000005 EVAL path_to_enlightenment.rb:6 [FINISH]
c:0001 p:0000 s:0003 E:0012a0 DUMMY [FINISH]

-- Ruby level backtrace information ----------------------------------------
path_to_enlightenment.rb:6:in <main>' <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in require'
internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:85:in require' <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in set_encoding'
internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb:85:in `method_missing'

-- C level backtrace information -------------------------------------------
C:\WINDOWS\SYSTEM32\ntdll.dll(NtWaitForSingleObject+0x14) [0x00007ffd595cecd4]
C:\WINDOWS\System32\KERNELBASE.dll(WaitForSingleObjectEx+0x8e) [0x00007ffd56ec9c2e]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_bugreport+0x256) [0x00007ffcb9fd2ee6]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_bug_for_fatal_signal+0x80) [0x00007ffcb9dd05b0]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_shape_memsize+0x542) [0x00007ffcb9f1e502]
[0x00007ff77f061e22]
C:\WINDOWS\System32\ucrtbase.dll(_C_specific_handler+0xa0) [0x00007ffd56b07f30]
C:\WINDOWS\SYSTEM32\ntdll.dll(_chkstk+0x12f) [0x00007ffd595d3cff]
C:\WINDOWS\SYSTEM32\ntdll.dll(RtlFindCharInUnicodeString+0xa96) [0x00007ffd5954e456]
C:\WINDOWS\SYSTEM32\ntdll.dll(KiUserExceptionDispatcher+0x2e) [0x00007ffd595d2cee]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_gc_disable_no_rest+0x344) [0x00007ffcb9df7774]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_gc_writebarrier+0x8e) [0x00007ffcb9df79de]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_iseqw_new+0x7b) [0x00007ffcb9e45eeb]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_nomethod_err_new+0xda) [0x00007ffcb9dd0e6a]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_pop_cfunc_frame+0x263) [0x00007ffcb9fafe13]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_pop_cfunc_frame+0x356) [0x00007ffcb9faff06]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_invoke_proc+0x1eb) [0x00007ffcb9fbb73b]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_obj_respond_to+0x3a9) [0x00007ffcb9fbf239]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_invoke_proc+0x52e) [0x00007ffcb9fbba7e]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_call_kw+0x20c) [0x00007ffcb9fca18c]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vrescue2+0x16e) [0x00007ffcb9ddbb5e]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_rescue2+0x2a) [0x00007ffcb9ddbdfa]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_check_funcall_basic_kw+0x378) [0x00007ffcb9fbd788]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_check_funcall_basic_kw+0x657) [0x00007ffcb9fbda67]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_check_funcall+0x1a) [0x00007ffcb9fbdbda]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_check_convert_type_with_id+0x49) [0x00007ffcb9e79cb9]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_io_close+0x125a) [0x00007ffcb9e2271a]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_io_check_closed+0xe5) [0x00007ffcb9e257d5]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_invoke_proc+0x1eb) [0x00007ffcb9fbb73b]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_eval_cmd_kw+0x5a3) [0x00007ffcb9fc0623]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_funcallv+0x11) [0x00007ffcb9fc0871]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(weak.Init_extra_exts.ruby_push_include+0x36a) [0x00007ffcb9f1920a]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_ensure+0x1dc) [0x00007ffcb9ddc2dc]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_parser_load_file+0xf1) [0x00007ffcb9f1ae91]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_resolve_feature_path+0x2dc4) [0x00007ffcb9e4cfb4]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_f_require+0x3f) [0x00007ffcb9e4d14f]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_error_arity+0x147) [0x00007ffcb9fa8b27]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_invoke_bmethod+0x190e) [0x00007ffcb9fb7e2e]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_opt_newarray_max+0x3ec) [0x00007ffcb9fc44cc]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_vm_exec+0x11c) [0x00007ffcb9fb560c]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(rb_call_end_proc+0x130) [0x00007ffcb9dd51f0]
C:\Ruby32-x64\bin\x64-ucrt-ruby320.dll(ruby_run_node+0xa5) [0x00007ffcb9ddafd5]
[0x00007ff77f062a20]
[0x00007ff77f0612ee]
[0x00007ff77f061406]
C:\WINDOWS\System32\KERNEL32.DLL(BaseThreadInitThunk+0x1d) [0x00007ffd575526bd]

-- Other runtime information -----------------------------------------------

  • Loaded script: path_to_enlightenment.rb

  • Loaded features:

    0 enumerator.so
    1 thread.rb
    2 fiber.so
    3 rational.so
    4 complex.so
    5 ruby2_keywords.rb
    6 C:/Ruby32-x64/lib/ruby/3.2.0/x64-mingw-ucrt/enc/encdb.so
    7 C:/Ruby32-x64/lib/ruby/3.2.0/x64-mingw-ucrt/enc/trans/transdb.so
    8 C:/Ruby32-x64/lib/ruby/3.2.0/x64-mingw-ucrt/rbconfig.rb
    9 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/compatibility.rb
    10 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/defaults.rb
    11 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/deprecate.rb
    12 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/errors.rb
    13 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/unknown_command_spell_checker.rb
    14 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/exceptions.rb
    15 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/basic_specification.rb
    16 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/stub_specification.rb
    17 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/platform.rb
    18 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/util/list.rb
    19 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/version.rb
    20 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/requirement.rb
    21 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/specification.rb
    22 C:/Ruby32-x64/lib/ruby/site_ruby/3.2.0/ruby_installer/runtime/singleton.rb
    23 C:/Ruby32-x64/lib/ruby/site_ruby/3.2.0/ruby_installer/runtime.rb
    24 C:/Ruby32-x64/lib/ruby/site_ruby/3.2.0/ruby_installer/runtime/msys2_installation.rb
    25 C:/Ruby32-x64/lib/ruby/3.2.0/x64-mingw-ucrt/win32/dll_directory.so
    26 C:/Ruby32-x64/lib/ruby/site_ruby/3.2.0/ruby_installer/runtime/dll_directory.rb
    27 C:/Ruby32-x64/lib/ruby/3.2.0/x64-mingw-ucrt/enc/utf_16le.so
    28 C:/Ruby32-x64/lib/ruby/3.2.0/x64-mingw-ucrt/enc/trans/utf_16_32.so
    29 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/text.rb
    30 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/user_interaction.rb
    31 C:/Ruby32-x64/lib/ruby/3.2.0/x64-mingw-ucrt/etc.so
    32 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/config_file.rb
    33 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/defaults/operating_system.rb
    34 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/util.rb
    35 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/dependency.rb
    36 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_gem.rb
    37 C:/Ruby32-x64/lib/ruby/3.2.0/x64-mingw-ucrt/monitor.so
    38 C:/Ruby32-x64/lib/ruby/3.2.0/monitor.rb
    39 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems.rb
    40 C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/path_support.rb
    41 C:/Ruby32-x64/lib/ruby/3.2.0/error_highlight/version.rb
    42 C:/Ruby32-x64/lib/ruby/3.2.0/error_highlight/base.rb
    43 C:/Ruby32-x64/lib/ruby/3.2.0/error_highlight/formatter.rb
    44 C:/Ruby32-x64/lib/ruby/3.2.0/error_highlight/core_ext.rb
    45 C:/Ruby32-x64/lib/ruby/3.2.0/error_highlight.rb
    46 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/version.rb
    47 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/core_ext/name_error.rb
    48 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/levenshtein.rb
    49 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/jaro_winkler.rb
    50 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/spell_checker.rb
    51 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
    52 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
    53 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/spell_checkers/name_error_checkers.rb
    54 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/spell_checkers/method_name_checker.rb
    55 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/spell_checkers/key_error_checker.rb
    56 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/spell_checkers/null_checker.rb
    57 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/tree_spell_checker.rb
    58 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/spell_checkers/require_path_checker.rb
    59 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/spell_checkers/pattern_key_name_checker.rb
    60 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean/formatter.rb
    61 C:/Ruby32-x64/lib/ruby/3.2.0/did_you_mean.rb
    62 C:/Ruby32-x64/lib/ruby/3.2.0/syntax_suggest/core_ext.rb
    63 C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/win32console-1.3.2/lib/Console_ext.so
    64 C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/win32console-1.3.2/lib/Win32/Console.rb
    65 C:/Ruby32-x64/lib/ruby/3.2.0/x64-mingw-ucrt/fiddle.so
    66 C:/Ruby32-x64/lib/ruby/3.2.0/fiddle/closure.rb
    67 C:/Ruby32-x64/lib/ruby/3.2.0/fiddle/function.rb
    68 C:/Ruby32-x64/lib/ruby/3.2.0/fiddle/version.rb
    69 C:/Ruby32-x64/lib/ruby/3.2.0/fiddle.rb
    70 C:/Ruby32-x64/lib/ruby/3.2.0/fiddle/value.rb
    71 C:/Ruby32-x64/lib/ruby/3.2.0/fiddle/pack.rb
    72 C:/Ruby32-x64/lib/ruby/3.2.0/fiddle/struct.rb
    73 C:/Ruby32-x64/lib/ruby/3.2.0/fiddle/cparser.rb
    74 C:/Ruby32-x64/lib/ruby/3.2.0/fiddle/import.rb
    75 C:/Ruby32-x64/lib/ruby/3.2.0/win32/registry.rb
    76 C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/win32console-1.3.2/lib/Win32/Console/ANSI.rb
    77 C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/win32console-1.3.2/lib/win32console.rb
    78 C:/Users/jlpeters/Documents/CodeLearning/ruby-koans/neo.rb
    79 C:/Users/jlpeters/Documents/CodeLearning/ruby-koans/about_asserts.rb

rake aborted!
Command failed with status (3): [C:/Ruby32-x64/bin/ruby.exe path_to_enlight...]
C:/Users/jlpeters/Documents/CodeLearning/ruby-koans/Rakefile:10:in `block in <top (required)>'
Tasks: TOP => default => test
(See full trace by running task with --trace)

Website is down

http://rubykoans.com/

Application error

An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail

Segmentation fault / bus error in about_symbols.rb

There are strange crashes when running the koans emanating from the file about_symbols.rb. The problematic piece of code is the block on lines 36-43:

in_ruby_version("mri") do
  RubyConstant = "What is the sound of one hand clapping?"
  def test_constants_become_symbols
    all_symbols_as_strings = Symbol.all_symbols.map { |x| x.to_s }

    assert_equal __, all_symbols_as_strings.include?(__)
  end
end

Specifically, the error occurs on the line 39 (that sets the variable all_symbols_as_string). I attach a rake output and ruby diagnostic report from one instance of the crash, manifesting as a segmentation fault. This failure is also sometimes reported as a bus error.

I use the state of the repository as in commit 3bb8d5d on macOS 13.2.1 (22D68) (on x86-64 Intel).

Rake output
Ruby diagnostic report

issue matching about_methods

when running thought the path_to_enlightment I got to this and what I saw:

assert_match(/__/, exception.message)

and the result of this test is:

The answers you seek...
  Expected "wrong number of arguments (given 0, expected 2)" to match /__/

Please meditate on the following code:
  **koans/about_methods.rb:39:in `test_calling_global_methods_with_wrong_number_of_arguments'

and I think the result should be:

assert_match(exception.message, /wrong number of arguments/)

if I am incorrect or misguided please notify me.

link to assumed code change

assert_match(/#{__(pattern)}/, exception.message)

Continuous Integration

Setup GitHub actions to run the koans against at least ruby latest and perhaps the last N versions.

Leverage the GitHub action scheduler to run this test periodically to detect incompatibility as ruby continues to evolve.

The old version of the code with an error is being downloaded from the website link.

Error on the website https://www.rubykoans.com/

The old version of the code with an error is being downloaded from the website link. In top-right button: https://github.com/edgecase/ruby_koans/blob/master/download/rubykoans.zip?raw=true

The downloaded archive contains old code and it has an error when working with Ruby 3.2.

koans/neo.rb:221:in `add_progress': undefined method `exists?' for File:Class (NoMethodError)

      exists = File.exists?(PROGRESS_FILE_NAME)

Fix, please for us.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.