ibsciss-middleware 0.4.1 → 0.4.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: 86fc76bf275b9613ba8eaf6234356f6e897e8fa2
4
- data.tar.gz: 40a061815db18be1438ce941abd3d8df47d80c96
3
+ metadata.gz: 95c0eb4642aeaec6b97dc52005fa57572acb48ee
4
+ data.tar.gz: 1d1bccc64c0398f96a21bb42f14517fb9bf89ff8
5
5
  SHA512:
6
- metadata.gz: 20bdeb80623bfad270d6a44d5d7d7c95dc00af9ce262728649ea88b90ae0bb6a1dae6c2cecef187363631fecc8718300e8b5ee6c54d445ffe2b603f0b7d30e57
7
- data.tar.gz: 7cfefa01cc28a9765bb715af5f1513acc8c839c47d241204ebcee26d4be57372b07c3fa74ba8ac4100e0a17218c4d507ab52070af24710ddde7f81c15d98abe2
6
+ metadata.gz: 24b5b1b08386e3e5a70d8a8f08d0ce888756105adc43f3d0bee08865e04f07f34141c94a321bd78e44e8f521b260c70eb4ccf2b22218cf00c6f30f94c5f40d32
7
+ data.tar.gz: 2a0258cd8b3d3e2a313cdd8e1f9be9549071a864781abf760c63a676316ce7146f694c5a0391f745403ac95d899070fa8af73b58ce29647abc4de79e0d7c8637
@@ -1,3 +1,10 @@
1
+ ## 0.4.2
2
+ - Update documentation
3
+ - Fix bug https://github.com/Ibsciss/ruby-middleware/issues/8
4
+
5
+ ## 0.4.1
6
+ - Simplify the inspect method
7
+
1
8
  ## 0.4.0
2
9
  - Add a name displayed in the logger & inspect methods
3
10
  - Add a logger middleware
data/README.md CHANGED
@@ -28,7 +28,7 @@ $ gem install ibsciss-middleware
28
28
  Or, in your Gemfile:
29
29
 
30
30
  ```
31
- gem 'ibsciss-middleware', '~> 0.3'
31
+ gem 'ibsciss-middleware', '~> 0.4.2'
32
32
  ```
33
33
 
34
34
  Then, you can add it to your project:
@@ -169,8 +169,8 @@ lambdas:
169
169
 
170
170
  ```ruby
171
171
  Middleware::Builder.new { |b|
172
- b.use lambda { |env| env + 3 }
173
- b.use lambda { |env| env * 2 }
172
+ b.use -> (env) { env + 3 }
173
+ b.use -> (env) { env * 2 }
174
174
  }.call(1) #return 8
175
175
  ```
176
176
 
@@ -188,7 +188,7 @@ for building a stack of middlewares:
188
188
  ```ruby
189
189
  stack = Middleware::Builder.new do |d|
190
190
  d.use Trace
191
- d.use lambda { |env| puts "LAMBDA!" }
191
+ d.use ->(env) { puts "LAMBDA!" }
192
192
  end
193
193
  ```
194
194
 
@@ -241,7 +241,7 @@ stack.insert_after(0, SomeOtherMiddleware)
241
241
  #### Insert after each
242
242
 
243
243
  ```ruby
244
- logger = lambda { |env| p env }
244
+ logger = -> (env) { p env }
245
245
 
246
246
  # Insert the middleware (can be also a middleware object) after each existing middleware
247
247
  stack.insert_after_each logger
@@ -250,7 +250,7 @@ stack.insert_after_each logger
250
250
  #### Insert before each
251
251
 
252
252
  ```ruby
253
- logger = lambda { |env| p env }
253
+ logger = -> (env) { p env }
254
254
 
255
255
  # Insert the middleware (can be also a middleware object) before each existing middleware
256
256
  stack.insert_before_each logger
@@ -84,8 +84,7 @@ module Middleware
84
84
  self
85
85
  end
86
86
 
87
- # Inserts a middleware at the given index or directly before the
88
- # given middleware object.
87
+ # Inserts a middleware at the given index or directly before the given middleware object.
89
88
  def insert(index, middleware, *args, &block)
90
89
  index = self.index(index) unless index.is_a?(Integer)
91
90
  fail "no such middleware to insert before: #{index.inspect}" unless index
@@ -115,16 +114,12 @@ module Middleware
115
114
  end
116
115
  end
117
116
 
118
- # Replaces the given middleware object or index with the new
119
- # middleware.
117
+ # Replaces the given middleware object or index with the new middleware.
120
118
  def replace(index, middleware, *args, &block)
121
- if index.is_a?(Integer)
122
- delete(index)
123
- insert(index, middleware, *args, &block)
124
- else
125
- insert_before(index, middleware, *args, &block)
126
- delete(index)
127
- end
119
+ index = self.index index unless index.is_a? Integer
120
+
121
+ delete(index)
122
+ insert(index, middleware, *args, &block)
128
123
  end
129
124
 
130
125
  # Deletes the given middleware object or index
@@ -19,5 +19,5 @@ Gem::Specification.new do |gem|
19
19
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
20
  gem.name = 'ibsciss-middleware'
21
21
  gem.require_paths = ['lib']
22
- gem.version = '0.4.1'
22
+ gem.version = '0.4.2'
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibsciss-middleware
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-17 00:00:00.000000000 Z
12
+ date: 2017-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake