evrone-common-rack-builder 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2eacfc8ae9b3c2a04d54b942e13707cca59731fa
4
- data.tar.gz: 840d408c8bacd02845616c1618fb3d3d4834b855
3
+ metadata.gz: 5ba65815360612b54d14c38a0685f7a15ccd7d3f
4
+ data.tar.gz: c42815371b5ae2ba3f49b8d660bd20e6adaff0f4
5
5
  SHA512:
6
- metadata.gz: b81a6f1efa94c2c5cf8e5469931147a8d19771b1f15c1805cdfdc3a0c86d653865e36e6254c6c5b6ff76e8e649db647bacee98894dcbb495716d8a437708ed03
7
- data.tar.gz: 57c0e41436f533621e1d1762cee461281f61db2dc66d9e1060d591a759365d39b2ef66d26f2827ff677dcdc11af0003d55af8aed763fd3f66ec0dd4ecec5600d
6
+ metadata.gz: 64715343c10daad4d70c7b4706c5d25050b1b96c2d1074d9514b72940e35249814236866ae2425f4b89af052f780e64b7cc83e54e1acae9c6b764bda2298d40d
7
+ data.tar.gz: db06381bd7e796df611ebe26573d2adf68f060e9b0374a3e0fd5dfcdacd8a8882b69aa09e439b6c51c6d7a6b564559d99ab9dbc88e4efe1759320cf791d96f1d
@@ -41,26 +41,8 @@ module Evrone
41
41
  @use << proc { |app| middleware.new(app, *args, &block) }
42
42
  end
43
43
 
44
- # Takes an argument that is an object that responds to #call and returns a Rack response.
45
- # The simplest form of this is a lambda object:
46
- #
47
- # run lambda { |env| [200, { "Content-Type" => "text/plain" }, ["OK"]] }
48
- #
49
- # However this could also be a class:
50
- #
51
- # class Heartbeat
52
- # def self.call(env)
53
- # [200, { "Content-Type" => "text/plain" }, ["OK"]]
54
- # end
55
- # end
56
- #
57
- # run Heartbeat
58
- def run(app)
59
- @run = app
60
- end
61
-
62
- def to_app
63
- app = @run
44
+ def to_app(app)
45
+ app ||= @run
64
46
  fail "missing run or map statement" unless app
65
47
  @use.reverse.inject(app) { |a,e| e[a] }
66
48
  end
@@ -2,7 +2,7 @@ module Evrone
2
2
  module Common
3
3
  module Rack
4
4
  class Builder
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.2"
6
6
  end
7
7
  end
8
8
  end
@@ -29,8 +29,7 @@ describe Evrone::Common::Rack::Builder do
29
29
  it "should be work" do
30
30
  env = []
31
31
  app = ->(c){ c << 'run' }
32
- builder.run app
33
- rs = builder.call env
32
+ rs = builder.to_app(app).call env
34
33
  expect(rs).to eq %w{ first.begin last.begin run last.end first.end }
35
34
  end
36
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evrone-common-rack-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky