File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020]
2121
2222glob = ARGV [ 0 ] || './apps/*.ru'
23- apps = Dir [ glob ] . each_with_object ( { } ) do |config , hash |
24- hash [ config ] = Rack ::Builder . parse_file ( config )
23+ apps = Dir [ glob ] . to_h do |config |
24+ [ config , Rack ::Builder . parse_file ( config ) ]
2525end
2626apps . freeze
2727
Original file line number Diff line number Diff line change 55Dir . glob ( 'Gemfile*' )
66 . reject { _1 . end_with? ( '.lock' ) }
77 . each do |filename |
8- puts `BUNDLE_GEMFILE=#{ filename } bundle update`
8+ puts `BUNDLE_GEMFILE=#{ filename } bundle update`
99end
1010puts `cd benchmarks && bundle update && cd ..`
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ def self.clear_cache!
2727 FileLoader . clear_cache!
2828 end
2929
30-
3130 # @return [Configuration]
3231 def self . configuration
3332 @configuration ||= Configuration . new
Original file line number Diff line number Diff line change 1212 end
1313
1414 let ( :contents ) do
15- requests . each_with_object ( { } ) do |req , hash |
16- hash [ req . content_type ] = req
15+ requests . to_h do |req |
16+ [ req . content_type , req ]
1717 end
1818 end
1919
4040
4141 it 'finds */* wildcard matcher' do
4242 requests = [ double ( content_type : 'application/json' ) , double ( content_type : '*/*' ) ]
43- contents = requests . each_with_object ( { } ) { |req , m | m [ req . content_type ] = req }
43+ contents = requests . to_h { |req | [ req . content_type , req ] }
4444 expect ( described_class . call ( contents , 'some/foobar' ) . content_type ) . to eq ( '*/*' )
4545 expect ( described_class . call ( contents , 'some/foobar; Chartset=utf8' ) . content_type ) . to eq ( '*/*' )
4646 end
4747
4848 it 'finds a match if content_type is not defined' do
4949 requests = [ double ( content_type : 'application/json' ) , double ( content_type : nil ) ]
50- contents = requests . each_with_object ( { } ) { |req , m | m [ req . content_type ] = req }
50+ contents = requests . to_h { |req | [ req . content_type , req ] }
5151 expect ( described_class . call ( contents , 'some/foobar' ) ) . to be ( requests [ 1 ] )
5252 end
5353 end
You can’t perform that action at this time.
0 commit comments