blob: 79e2b701ec993435a0dcc84bb4dbe5f71e750cb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
require "json"
def shelf_contents(data)
data.map { |bottle|
$cgi.div(class: "shelf") {
$cgi.h3 { bottle["name"] } +
$cgi.img(class: "bottle",
src: "shelf/#{bottle["image"]}")
}
}.join
end
data = JSON.parse(File.read("../inc/shelf.json"))
$page =
$cgi.div {
$cgi.h2 { "What's on my shelf?" } +
$cgi.div { shelf_contents(data) }
}
# vim: set filetype=ruby:
|