8000 GitHub - porras/rubystdlib: Slides, examples and reference links from my talk “5 gems of the Ruby Standard Library”
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

porras/rubystdlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

5 hidden gems of the Ruby Standard Library

These are the slides, code examples and reference links for my talk “5 hidden gems of the Ruby Standard Library“, as presented in:

Code examples

If you listened to the talk and were paying attention, you might have noticed that I talked about 6 libraries, not 5. That's because the parts about rake and shellwords were a bit intertwined. There is an example file for each of them though, so that's why there are six (this is the order in which I presented them, but other than the mentioned rake-shellwords there is not any dependency):

  • set
  • queue
  • rake
  • shellwords
  • fiddle
  • pstore

Running the examples

All the examples work and are tested with MRI Ruby 2.2.21. Some of them probably work with every version of every Ruby, some other definitely not. If you find one that doesn't work in some Ruby implementation and the fix is easy, pull requests are welcome :)

1 the queue example can be simplified thanks to an addition in Ruby 2.3. See this branch.

There is one file per library, except for fiddle, for which there is a directory.

To run the single file examples, you just need the usual:

$ ruby <file.rb>

They will print some results which will make sense if you read the code. You're of course encouraged to play with them, make small changes, etc. The pstore example will print something different each time, because each run will take the database where the previous run left it. That's the point of databases ;)

To run the fiddle example, change into its directory, and run make run:

$ cd fiddle
$ make run

This will compile the C code (you will need make and gcc installed, these instructions for Mac, Ubuntu and Windows can probably help), and run the example.

The fiddle/go and fiddle/crystal directories contain the example redone (partially, only the most basic part, for demonstration purposes) in Go and Crystal. They work the same (make run), but they require Go 1.5 or Crystal (not sure which versions work, definitely with 0.9.0).

Reference links

About

Slides, examples and reference links from my talk “5 gems of the Ruby Standard Library”

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0