Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ruby-hacking-guide/ruby-hacking-guide.github.com
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: gh-pages
Choose a base ref
...
head repository: ruby-hacking-guide/ruby-hacking-guide.github.com
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 108,743 additions and 1 deletion.
  1. +4 −0 .gitignore
  2. +3 −0 Gemfile
  3. +40 −0 Gemfile.lock
  4. +90 −0 README.md
  5. +3 −0 _config.yml
  6. +34 −0 _layouts/default.html
  7. +59 −0 _plugins/rhg_textile_converter.rb
  8. +829 −0 anyeval.textile
  9. +1,690 −0 class.textile
  10. +2,147 −0 contextual.textile
  11. +173 −0 css/styles.css
  12. +27 −0 dictionary.txt
  13. +1,583 −0 evaluator.textile
  14. BIN favicon.ico
  15. +535 −0 fin.textile
  16. +2,128 −0 gc.textile
  17. BIN images/book_cover.jpg
  18. BIN images/ch_abstract_build.jpg
  19. BIN images/ch_abstract_ci.jpg
  20. BIN images/ch_abstract_repo.jpg
  21. BIN images/ch_abstract_syntree.jpg
  22. BIN images/ch_anyeval_dynavars.jpg
  23. BIN images/ch_anyeval_speceval.jpg
  24. BIN images/ch_class_addsclass.png
  25. BIN images/ch_class_boot1.png
  26. BIN images/ch_class_include.png
  27. BIN images/ch_class_infloop.png
  28. BIN images/ch_class_metaclass.png
  29. BIN images/ch_class_metaobj.png
  30. BIN images/ch_class_metatree.png
  31. BIN images/ch_class_mmm.png
  32. BIN images/ch_class_multi.png
  33. BIN images/ch_class_real.png
  34. BIN images/ch_class_reqlink.png
  35. BIN images/ch_class_simulate.png
  36. BIN images/ch_class_symbolic.png
  37. BIN images/ch_contextual_condp.jpg
  38. BIN images/ch_contextual_transittobeg.jpg
  39. BIN images/ch_contextual_trees.jpg
  40. BIN images/ch_evaluator_jumptag.jpg
  41. BIN images/ch_evaluator_rbeval.jpg
  42. BIN images/ch_evaluator_setjmp.jpg
  43. BIN images/ch_evaluator_tagstack.jpg
  44. BIN images/ch_evaluator_usetag.jpg
  45. BIN images/ch_evaluator_whilejmp.jpg
  46. BIN images/ch_gc_calloca.jpg
  47. BIN images/ch_gc_cycle.jpg
  48. BIN images/ch_gc_gcimage.jpg
  49. BIN images/ch_gc_gengc.jpg
  50. BIN images/ch_gc_heapitems.jpg
  51. BIN images/ch_gc_heaps.jpg
  52. BIN images/ch_gc_macstack.jpg
  53. BIN images/ch_gc_mostcopy.jpg
  54. BIN images/ch_gc_objects.jpg
  55. BIN images/ch_gc_objid.jpg
  56. BIN images/ch_gc_refcnt.jpg
  57. BIN images/ch_gc_stop2.jpg
  58. BIN images/ch_gc_stop3.jpg
  59. BIN images/ch_iterator_dst.jpg
  60. BIN images/ch_iterator_dynavarseval.jpg
  61. BIN images/ch_iterator_flaginfect.jpg
  62. BIN images/ch_iterator_framepush.jpg
  63. BIN images/ch_iterator_insert.jpg
  64. BIN images/ch_iterator_itertrans.jpg
  65. BIN images/ch_iterator_stacks.jpg
  66. BIN images/ch_load_link.jpg
  67. BIN images/ch_load_loadwait.jpg
  68. BIN images/ch_method_anchor.jpg
  69. BIN images/ch_method_mhash.jpg
  70. BIN images/ch_method_msearch.jpg
  71. BIN images/ch_minimum_Kernel.jpg
  72. BIN images/ch_minimum_ccc.jpg
  73. BIN images/ch_minimum_classclass.jpg
  74. BIN images/ch_minimum_classtree.jpg
  75. BIN images/ch_minimum_const.jpg
  76. BIN images/ch_minimum_constref.jpg
  77. BIN images/ch_minimum_metaobjects.jpg
  78. BIN images/ch_minimum_modclass.jpg
  79. BIN images/ch_minimum_modclass2.jpg
  80. BIN images/ch_minimum_modinherit.jpg
  81. BIN images/ch_minimum_multiinherit.jpg
  82. BIN images/ch_minimum_objimage.jpg
  83. BIN images/ch_minimum_reference.jpg
  84. BIN images/ch_minimum_reference.png
  85. BIN images/ch_minimum_supersub.jpg
  86. BIN images/ch_module_cbase.jpg
  87. BIN images/ch_module_crefstack.jpg
  88. BIN images/ch_module_framestack.jpg
  89. BIN images/ch_module_localvars.jpg
  90. BIN images/ch_module_massign.jpg
  91. BIN images/ch_module_scopestack.jpg
  92. BIN images/ch_module_stack.jpg
  93. BIN images/ch_module_tmpprotecttmp.jpg
  94. BIN images/ch_module_vars.jpg
  95. BIN images/ch_name_array.png
  96. BIN images/ch_name_aset.png
  97. BIN images/ch_name_chain.png
  98. BIN images/ch_name_nexti.png
  99. BIN images/ch_name_sttable.png
  100. BIN images/ch_object_class.png
  101. BIN images/ch_object_classtree.png
  102. BIN images/ch_object_flags.png
  103. BIN images/ch_object_givtable.png
  104. BIN images/ch_object_rbasic.png
  105. BIN images/ch_object_rdata.png
  106. BIN images/ch_object_string.png
  107. BIN images/ch_object_value.png
  108. BIN images/ch_parser_ablist.jpg
  109. BIN images/ch_parser_alist.jpg
  110. BIN images/ch_parser_build.jpg
  111. BIN images/ch_parser_exprloop.jpg
  112. BIN images/ch_parser_heredoc.jpg
  113. BIN images/ch_parser_ibuffer.jpg
  114. BIN images/ch_parser_interf.jpg
  115. BIN images/ch_parser_lexparams.jpg
  116. BIN images/ch_parser_progloop.jpg
  117. BIN images/ch_parser_scanner.jpg
  118. BIN images/ch_parser_tbuffer.jpg
  119. BIN images/ch_syntree_append.jpg
  120. BIN images/ch_syntree_blocklist.jpg
  121. BIN images/ch_syntree_callgraph.jpg
  122. BIN images/ch_syntree_dynavars.jpg
  123. BIN images/ch_syntree_flagUsage.jpg
  124. BIN images/ch_syntree_flags.jpg
  125. BIN images/ch_syntree_lmask.jpg
  126. BIN images/ch_syntree_localtbl.jpg
  127. BIN images/ch_syntree_localvars.jpg
  128. BIN images/ch_syntree_lvtbltbl.jpg
  129. BIN images/ch_syntree_stree.jpg
  130. BIN images/ch_syntree_tbl.jpg
  131. BIN images/ch_thread_fdset.jpg
  132. BIN images/ch_thread_setjmploop.jpg
  133. BIN images/ch_thread_thread.jpg
  134. BIN images/ch_thread_twodirection.jpg
  135. BIN images/ch_variable_gaccess.png
  136. BIN images/ch_variable_gvar.png
  137. BIN images/ch_yacc_build.jpg
  138. BIN images/ch_yacc_yaccvars.jpg
  139. BIN images/somerights20.png
  140. BIN images/visual_language.png
  141. +0 −1 index.html
  142. +84 −0 index.textile
  143. +1,484 −0 intro.textile
  144. +1,319 −0 iterator.textile
  145. +1,088 −0 load.textile
  146. +1,068 −0 method.textile
  147. +1,488 −0 minimum.textile
  148. +2,045 −0 module.textile
  149. +674 −0 name.textile
  150. +1,173 −0 object.textile
  151. +26 −0 original_repo/en/Rakefile
  152. +1,110 −0 original_repo/en/chapter02.txt
  153. +653 −0 original_repo/en/chapter03.txt
  154. +1,653 −0 original_repo/en/chapter04.txt
  155. +657 −0 original_repo/en/chapter06.txt
  156. +207 −0 original_repo/en/chapter07.txt
  157. +1,077 −0 original_repo/en/chapter09.txt
  158. +1,960 −0 original_repo/en/chapter10.txt
  159. +1,021 −0 original_repo/en/chapter18.txt
  160. +449 −0 original_repo/en/diagrams/ch_class_addsclass.svg
  161. +437 −0 original_repo/en/diagrams/ch_class_boot1.svg
  162. +275 −0 original_repo/en/diagrams/ch_class_include.svg
  163. +639 −0 original_repo/en/diagrams/ch_class_infloop.svg
  164. +269 −0 original_repo/en/diagrams/ch_class_metaclass.svg
  165. +347 −0 original_repo/en/diagrams/ch_class_metaobj.svg
  166. +533 −0 original_repo/en/diagrams/ch_class_metatree.svg
  167. +538 −0 original_repo/en/diagrams/ch_class_mmm.svg
  168. +548 −0 original_repo/en/diagrams/ch_class_multi.svg
  169. +248 −0 original_repo/en/diagrams/ch_class_real.svg
  170. +169 −0 original_repo/en/diagrams/ch_class_reqlink.svg
  171. +604 −0 original_repo/en/diagrams/ch_class_simulate.svg
  172. +693 −0 original_repo/en/diagrams/ch_class_symbolic.svg
  173. +790 −0 original_repo/en/diagrams/ch_name_array.svg
  174. +1,066 −0 original_repo/en/diagrams/ch_name_aset.svg
  175. +786 −0 original_repo/en/diagrams/ch_name_chain.svg
  176. +674 −0 original_repo/en/diagrams/ch_name_nexti.svg
  177. +1,521 −0 original_repo/en/diagrams/ch_name_sttable.svg
  178. +794 −0 original_repo/en/diagrams/ch_variable_gaccess.svg
  179. +1,178 −0 original_repo/en/diagrams/ch_variable_gvar.svg
  180. +914 −0 original_repo/en/diagrams/visual_language.svg
  181. +26 −0 original_repo/en/generate_html.rb
  182. BIN original_repo/en/images/ch_class_addsclass.png
  183. BIN original_repo/en/images/ch_class_boot1.png
  184. BIN original_repo/en/images/ch_class_include.png
  185. BIN original_repo/en/images/ch_class_infloop.png
  186. BIN original_repo/en/images/ch_class_metaclass.png
  187. BIN original_repo/en/images/ch_class_metaobj.png
  188. BIN original_repo/en/images/ch_class_metatree.png
  189. BIN original_repo/en/images/ch_class_mmm.png
  190. BIN original_repo/en/images/ch_class_multi.png
  191. BIN original_repo/en/images/ch_class_real.png
  192. BIN original_repo/en/images/ch_class_reqlink.png
  193. BIN original_repo/en/images/ch_class_simulate.png
  194. BIN original_repo/en/images/ch_class_symbolic.png
  195. BIN original_repo/en/images/ch_name_array.png
  196. BIN original_repo/en/images/ch_name_aset.png
  197. BIN original_repo/en/images/ch_name_chain.png
  198. BIN original_repo/en/images/ch_name_nexti.png
  199. BIN original_repo/en/images/ch_name_sttable.png
  200. BIN original_repo/en/images/ch_object_class.png
  201. BIN original_repo/en/images/ch_object_classtree.png
  202. BIN original_repo/en/images/ch_object_flags.png
  203. BIN original_repo/en/images/ch_object_givtable.png
  204. BIN original_repo/en/images/ch_object_rbasic.png
  205. BIN original_repo/en/images/ch_object_rdata.png
  206. BIN original_repo/en/images/ch_object_string.png
  207. BIN original_repo/en/images/ch_object_value.png
  208. BIN original_repo/en/images/ch_variable_gaccess.png
  209. BIN original_repo/en/images/ch_variable_gvar.png
  210. BIN original_repo/en/images/somerights20.png
  211. BIN original_repo/en/images/visual_language.png
  212. +99 −0 original_repo/en/index.txt
  213. +119 −0 original_repo/en/rhg.css
  214. +44 −0 original_repo/en/upload.rb
  215. +1,195 −0 original_repo/fr/chapitre02.txt
  216. +675 −0 original_repo/fr/chapitre03.txt
  217. +26 −0 original_repo/fr/genere_html.rb
  218. BIN original_repo/fr/images/somerights20.fr.png
  219. +119 −0 original_repo/fr/rhg.css
  220. +1,421 −0 original_repo/ja/chapter01.txt
  221. +1,112 −0 original_repo/ja/chapter02.txt
  222. +641 −0 original_repo/ja/chapter03.txt
  223. +1,593 −0 original_repo/ja/chapter04.txt
  224. +1,713 −0 original_repo/ja/chapter05.txt
  225. +643 −0 original_repo/ja/chapter06.txt
  226. +208 −0 original_repo/ja/chapter07.txt
  227. +2,010 −0 original_repo/ja/chapter08.txt
  228. +1,048 −0 original_repo/ja/chapter09.txt
  229. +1,953 −0 original_repo/ja/chapter10.txt
  230. +2,052 −0 original_repo/ja/chapter11.txt
  231. +1,623 −0 original_repo/ja/chapter12.txt
  232. +1,258 −0 original_repo/ja/chapter13.txt
  233. +1,599 −0 original_repo/ja/chapter14.txt
  234. +894 −0 original_repo/ja/chapter15.txt
  235. +1,044 −0 original_repo/ja/chapter16.txt
  236. +677 −0 original_repo/ja/chapter17.txt
  237. +1,001 −0 original_repo/ja/chapter18.txt
  238. +1,133 −0 original_repo/ja/chapter19.txt
  239. +436 −0 original_repo/ja/chapter20.txt
  240. +61 −0 original_repo/ja/convert_html.rb
  241. +868 −0 original_repo/ja_html/anyeval.html
  242. +112 −0 original_repo/ja_html/anyeval.textile
  243. +2,127 −0 original_repo/ja_html/class.html
  244. +2,766 −0 original_repo/ja_html/contextual.html
  245. +1,648 −0 original_repo/ja_html/evaluator.html
  246. +651 −0 original_repo/ja_html/fin.html
  247. +93 −0 original_repo/ja_html/index.html
  248. +1,347 −0 original_repo/ja_html/iterator.html
  249. +1,327 −0 original_repo/ja_html/load.html
  250. +1,119 −0 original_repo/ja_html/method.html
  251. +1,953 −0 original_repo/ja_html/minimum.html
  252. +2,121 −0 original_repo/ja_html/module.html
  253. +862 −0 original_repo/ja_html/name.html
  254. +1,534 −0 original_repo/ja_html/object.html
  255. +2,500 −0 original_repo/ja_html/parser.html
  256. +280 −0 original_repo/ja_html/security.html
  257. +2,678 −0 original_repo/ja_html/spec.html
  258. +2,137 −0 original_repo/ja_html/syntree.html
  259. +1,496 −0 original_repo/ja_html/thread.html
  260. +895 −0 original_repo/ja_html/variable.html
  261. +1,441 −0 original_repo/ja_html/yacc.html
  262. +2,334 −0 parser.textile
  263. +301 −0 preface.textile
  264. +2 −0 script/Gemfile
  265. +14 −0 script/Gemfile.lock
  266. +157 −0 script/publish
  267. +242 −0 security.textile
  268. +2,150 −0 spec.textile
  269. +2,141 −0 syntree.textile
  270. +1,479 −0 thread.textile
  271. +668 −0 variable.textile
  272. +1,273 −0 yacc.textile
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_site
ebooks
*#
*~
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"
gem "jekyll"
gem "RedCloth"
40 changes: 40 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
GEM
remote: https://rubygems.org/
specs:
RedCloth (4.2.9)
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
colorator (0.1)
commander (4.1.3)
highline (~> 1.6.11)
directory_watcher (1.4.1)
fast-stemmer (1.0.2)
highline (1.6.19)
jekyll (1.0.3)
classifier (~> 1.3)
colorator (~> 0.1)
commander (~> 4.1.3)
directory_watcher (~> 1.4.1)
kramdown (~> 1.0.2)
liquid (~> 2.3)
maruku (~> 0.5)
pygments.rb (~> 0.5.0)
safe_yaml (~> 0.7.0)
kramdown (1.0.2)
liquid (2.5.0)
maruku (0.6.1)
syntax (>= 1.0.0)
posix-spawn (0.3.6)
pygments.rb (0.5.2)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
safe_yaml (0.7.1)
syntax (1.0.0)
yajl-ruby (1.1.0)

PLATFORMS
ruby

DEPENDENCIES
RedCloth
jekyll
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Ruby Hacking Guide Translation
==============================
[Read the translated guide here](http://ruby-hacking-guide.github.io/)

[Contributors](https://github.com/ruby-hacking-guide/ruby-hacking-guide.github.com/graphs/contributors)
--------------

Previous contributors to SVN repo
---------------------------------

* Vincent Isambart
* Meinrad Recheis
* Laurent Sansonetti
* Clifford Escobar Caoile
* Jean-Denis Vauguet
* Robert Gravina

Running the site locally
==========

```sh
$ git clone https://github.com/ruby-hacking-guide/ruby-hacking-guide.github.com
$ gem install jekyll
$ gem install RedCloth
$ jekyll serve # this compiles files and starts a server on localhost:4000.
```


For Bundler users
```sh
$ git clone https://github.com/ruby-hacking-guide/ruby-hacking-guide.github.com
$ bundle install
$ jekyll serve # this compiles files and starts a server on localhost:4000.
```


[Jekyll usage](https://github.com/mojombo/jekyll/wiki/usage)


Reading in EPUB
=========

Thanks to @avsej, we can read this book in EPUB.

To generate an EPUB file, you need to install eeepub additionally.

```sh
$ gem install rubyzip -v 0.9.9
$ gem install eeepub
$ ruby script/publish
```

You can convert a generated EPUB file into other formats by using Calibre.

The generated files in various formats are also available:

* http://files.avsej.net/rhg-2013-10-03_e5203a.epub
* http://files.avsej.net/rhg-2013-10-03_e5203a.mobi
* http://files.avsej.net/rhg-2013-10-03_e5203a.pdf


About the version of ruby explained
==========

The version of ruby used is ruby (1.7.3 2002-09-12).

It's almost a year before the release of Ruby 1.8.0,
so things explained in this book are basically the same in Ruby 1.8.

The details about this version are written in the
[Introduction](http://ruby-hacking-guide.github.io/intro.html)

You can download it from the official support site of the book.
* http://i.loveruby.net/ja/rhg/ar/ruby-rhg.tar.gz
* http://i.loveruby.net/ja/rhg/ar/ruby-rhg.zip

It's also available from this Organization's repo at
* https://github.com/ruby-hacking-guide/ruby-1.7.3


License
=======

Copyright (c) 2002-2004 Minero Aoki, All rights reserved.

This translation work is licensed under a
[Creative Commons Attribution-NonCommercial-ShareAlike2.5 License](http://creativecommons.org/licenses/by-nc-sa/2.5/)

If you'd like to translate this work to another language,
please contact the author Minero Aoki <aamine@loveruby.net>.
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
redcloth:
hard_breaks: false
exclude: ["ebooks", "script", "original_repo", "Gemfile", "Gemfile.lock", "dictionary.txt", "README.md"]
34 changes: 34 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title> {% if page.title %} {{ page.title }} | {% endif %} Ruby Hacking Guide </title>
<link rel="stylesheet" href="/css/styles.css" />
</head>
<body>

<div id="main">

<header>
<h1><a href="/">Ruby Hacking Guide</a></h1>
</header>

<nav role="navigation">
<ul>
</ul>
</nav>

{{ content }}

<footer>
The original work is Copyright © 2002 - 2004 Minero AOKI.
Translated by Vincent ISAMBART and Clifford Escobar CAOILE
This work is licensed under a
<p>
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.5/">Creative Commons Attribution-NonCommercial-ShareAlike2.5 License</a>
</p>
</footer>

</div>
</body>
</html>
59 changes: 59 additions & 0 deletions _plugins/rhg_textile_converter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
require "jekyll/converters/textile"
module Jekyll::Converters
class RhgTextile < Textile
safe true

# set this :low before "jekyll serve" when you want to use only Jekyll::Converters::Textile
priority :high

RHG_CODE_RE = /`([^`]+)`/
RHG_IMAGE_RE = /^!(.+\.(?:jpg|png))\((.+)\)!/

def convert(content)
# try to enable the <code> syntax of the original RubyForge project,
# but not fully.
lines = content.lines
skips = []
skips << "cvs diff parse.y" # chapter 11
skips << "69 EXPR_DOT, /*" # chapter 11
content = lines.map do |line|
unless skips.any? {|s| line.include? s }
line = line.gsub(RHG_CODE_RE) { "<code>#{$1}</code>" }
end

# this applies the markup of the original book and
# fixes improper markups of the generated htmls at the same time.
if line =~ /^▼ /
line = %{<p class="caption">#{line.rstrip}</p>\n}
end

line
end.join

# try to apply the style for images of the original book
figc = 0
no_figc = content.include? %{class="image"}
content.gsub!(RHG_IMAGE_RE) do |m|
figc += 1
src, title = $~[1..2]
alt = "(" + src.split(".").first.split("_").last + ")"
title = "Figure #{figc}: #{title}" unless no_figc
out = <<-EOS
<p class="image">
<img src="#{src}" alt="#{alt}"><br>
#{title}
</p>
EOS
end

super content
end

unless Jekyll::Converter.respond_to? :descendants
# simulate Jekyll::Converter.inherited
Jekyll::Converter.subclasses << self
Jekyll::Converter.subclasses.sort!
end
end
end

Loading