Add syntax highlighting

Alex Fonseka
2019-12-20 09:23:59 +11:00
parent d393c3ddeb
commit a60fdfc606
+4 -4
@@ -8,7 +8,7 @@ Lets first define some class in Ruby code, and try to access this from C:
Create a file `wiki-example.rb` with the following content. This class is already prepared for the next section (manipulating Ruby classes from C). We now only need the 'get_version' method.
`````
`````ruby
module WikiExample
class WikiManager
attr_accessor :active
@@ -28,7 +28,7 @@ end
Then we write a C stub and small program to access this code. We first initialize mruby, then load the code file and the third step is to access the module, class and instance method.
Name the file `wiki-example.c`.
`````
`````c
#include "mruby.h"
#include "mruby/irep.h"
@@ -78,7 +78,7 @@ The strategy is first to update the existing class. Here we add a C-method to th
To add a method to a class, we first need a reference to the class. We can copy the lines from the first example for getting a reference to the class WikiManager, of just insert the next lines just before the `If crashed...` comment line.
`````
`````c
// add the method to the WikiManager class
mrb_define_method(mrb, class, "_we_connected", we_connected, MRB_ARGS_NONE());
@@ -88,7 +88,7 @@ To add a method to a class, we first need a reference to the class. We can copy
Then we add the following method between the `#include` and `int main` lines:
`````
`````c
mrb_value
we_connected(mrb_state* mrb, mrb_value self){
// we need an int from the args