Today I Learned

Giant Monkeys Learning

Copy-paste friendly executable comments in Ruby

Imagine this comment on top of a ruby file: ```ruby

usage:

reset and seed database

rake db:reset

get korona base data

rails runner 'Korona.synchronize_all!'

create valid day tickets in local development

rails runner rails-runner/create_valid_ticket_for_shop_tests.rb

It is supposed to document the usage and gives executable example lines. However to use them verbatim you have to copy-paste them line by line, removing the leading `#`.

There is a better alternative using the [mostly frowned upon](https://stackoverflow.com/a/3000121/1162143) `=begin` / `=end` comment style:
```ruby
=begin usage:
rake db:reset                                                   # reset and seed database
rails runner 'Korona.synchronize_all!'                          # get korona base data
rails runner rails-runner/create_valid_ticket_for_shop_tests.rb # create valid day tickets in local development
=end

Now it is possible to copy-paste the whole block into a shell to execute.