File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ layout : nil
3
+ ---
4
+
5
+ {% highlight ruby %}
6
+ # Ruby knows what you
7
+ # mean, even if you
8
+ # want to do math on
9
+ # an entire Array
10
+ cities = %w[ London
11
+ Oslo
12
+ Paris
13
+ Amsterdam
14
+ Berlin ]
15
+ visited = %w[Berlin Oslo]
16
+
17
+ puts "I still need " +
18
+ "to visit the " +
19
+ "following cities:",
20
+ cities - visited
21
+ {% endhighlight %}
Original file line number Diff line number Diff line change
1
+ ---
2
+ layout : nil
3
+ ---
4
+
5
+ {% highlight ruby %}
6
+ # The Greeter class
7
+ class Greeter
8
+ def initialize(name)
9
+ @name = name.capitalize
10
+ end
11
+
12
+ def salute
13
+ puts "Hello #{@name}!"
14
+ end
15
+ end
16
+
17
+ # Create a new object
18
+ g = Greeter.new("world")
19
+
20
+ # Output "Hello World!"
21
+ g.salute
22
+ {% endhighlight %}
You can’t perform that action at this time.
0 commit comments