Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

server and gemspec

  • Loading branch information...
commit 4087d7f059c5029fb71c076baaa2c8bebe669faf 0 parents
@substack authored
Showing with 28 additions and 0 deletions.
  1. +13 −0 dnode-bart.gemspec
  2. +15 −0 server.rb
13 dnode-bart.gemspec
@@ -0,0 +1,13 @@
+Gem::Specification.new do |s|
+ s.name = 'dnode-bart'
+ s.version = '0.0.0'
+ s.summary = 'BART data as a dnode service'
+ s.files = [ 'server.rb' ]
+
+ s.authors = ['James Halliday']
+ s.date = '2011-11-06'
+ s.email = 'mail@substack.net'
+ s.extra_rdoc_files = [ 'LICENSE' ]
+ s.homepage = 'http://github.com/substack/dnode-bart.rb'
+ s.add_dependency 'dnode'
+end
15 server.rb
@@ -0,0 +1,15 @@
+require 'rubygems'
+require 'dnode'
+require 'bart/station'
+
+DNode.new({
+ :list => Bart::Station::LIST,
+ :names => Bart::Station::ID_TO_NAME,
+ :departures => lambda do |name,cb|
+ station = Bart::Station.new(name)
+ station.load_departures
+ if cb.respond_to? :call then
+ cb.call(station.departures)
+ end
+ end,
+}).listen(5050)
Please sign in to comment.
Something went wrong with that request. Please try again.