iamjwc-hirb 0.1.1 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/hirb/app.rb +13 -11
  2. metadata +1 -1
data/lib/hirb/app.rb CHANGED
@@ -1,18 +1,20 @@
1
1
  require 'rack'
2
2
 
3
3
  class Hirb::App
4
- class << self
5
- def call(env)
6
- r = Rack::Request.new(env)
4
+ def initialize(app)
5
+ @app = app
6
+ end
7
+
8
+ def call(env)
9
+ r = Rack::Request.new(env)
7
10
 
8
- if r.path_info =~ /^\/hirb\/eval/
9
- [200, {"Content-Type" => "text/plain"}, Hirb::Eval.boom_shakalaka(r[:cmd])]
10
- elsif r.path_info =~ /^\/hirb/
11
- html = File.read(File.join(File.dirname(__FILE__), "..", "..", "public", "hirb", "index.html"))
12
- [200, {"Content-Type" => "text/html", "Content-Length" => html.size.to_s}, html]
13
- else
14
- [404, {"Content-Type" => "text/html"}, "Not Found"]
15
- end
11
+ if r.path_info =~ /^\/hirb\/eval/
12
+ [200, {"Content-Type" => "text/plain"}, Hirb::Eval.boom_shakalaka(r[:cmd])]
13
+ elsif r.path_info =~ /^\/hirb/
14
+ html = File.read(File.join(File.dirname(__FILE__), "..", "..", "public", "hirb", "index.html"))
15
+ [200, {"Content-Type" => "text/html", "Content-Length" => html.size.to_s}, html]
16
+ else
17
+ @app.call(env)
16
18
  end
17
19
  end
18
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iamjwc-hirb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Camerer