Skip to content

Commit a9cec8e

Browse files
committed
Store random code examples in examples/.
1 parent 8c3e531 commit a9cec8e

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

examples/cities.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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 %}

examples/greeter.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 %}

0 commit comments

Comments
 (0)