Sha256: 9d62c809a90857402bad882a884d05a55f4c6704a6f6669fdb5d189ae240a736

Contents?: true

Size: 495 Bytes

Versions: 1

Compression:

Stored size: 495 Bytes

Contents

require 'sinatra/base'

module Rack
  class D3js < Sinatra::Base
    Root = ::File.dirname ::File.dirname ::File.dirname __FILE__
    D3jsFile = ::File.join Root, "dep", "d3", "d3.js"
    D3jsMinFile = ::File.join Root, "dep", "d3", "d3.min.js"

    get "/d3.js" do
      serve D3jsFile
    end

    get "/d3.min.js" do
      serve D3jsMinFile
    end

    def serve name
      content_type "application/javascript"
      last_modified ::File.mtime name
      ::File.read name
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-d3js-3.4.10 lib/rack/d3js.rb