Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Preface
1. Tokenization, Parsing and Compilation
Tokens: the words that make up the Ruby language
Experiment 1-1: Using Ripper to tokenize different Ruby scripts
Parsing: how Ruby understands the code you write
Experiment 1-2: Using Ripper to parse different Ruby scripts
Compilation: how Ruby translates your code into a new language
Experiment 1-3: Using the RubyVM class to display YARV instructions
Tokenization, parsing and compilation in JRuby
Tokenization, parsing and compilation in Rubinius
2. How Ruby Executes Your Code
YARV's internal stack and your Ruby stack
Experiment 2-1: Benchmarking Ruby 1.9 vs. Ruby 1.8
Local and dynamic access of Ruby variables
Experiment 2-2: Exploring special variables
How YARV controls your program's execution flow
Experiment 2-3: Testing how Ruby implements for loops internally
How JRuby executes your code
How Rubinius executes your code
3. Objects, Classes and Modules
What's inside a Ruby object?
Experiment 3-1: How long does it take to save a new instance variable?
Deducing what's inside the RClass structure
Experiment 3-2: Where does Ruby save class methods?
How Ruby implements modules and method lookup
Experiment 3-3: Modifying a module after including it
Objects, classes and modules in JRuby
Objects, classes and modules in Rubinius
4. Hash Tables
Hash tables in Ruby
Experiment 4-1: Retrieving a value from hashes of varying sizes
How hash tables expand to accommodate more values
Experiment 4-2: Inserting one new element into hashes of varying sizes
How Ruby implements hash functions
Experiment 4-3: Using objects as keys in a hash
Hash tables in JRuby
Hash tables in Rubinius
5. How Ruby Borrowed a Decades Old Idea From Lisp
Blocks: Closures in Ruby
Experiment 5-1: Which is faster: a while loop or passing a block to each?
Lambdas and Procs: treating functions as a first class citizen
Experiment 5-2: Changing local variables after calling lambda
Metaprogramming and closures: eval, instance_eval and binding
Experiment 5-3: Using a closure to define a method
Closures in JRuby
Closures in Rubinius
Conclusion
← Prev
Back
Next →
← Prev
Back
Next →