Skip to content

Instantly share code, notes, and snippets.

@pelly
pelly / data_table.rb
Created Oct 13, 2016
data table wrapper
View data_table.rb
class DataTable
include Enumerable
class Row
def initialize(headers_index: headers_index, row: row)
@headers_index = headers_index
@row = row
end
def [](name)
@row[@headers_index[name]]
View index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/d3/3.2.2/d3.v3.min.js"></script>
<script type="text/javascript" src="http://x3dom.org/x3dom/example/x3dom.js"></script>
</head>
<body>
</body>