hobby 0.0.10 → 0.0.11

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: 39a8b0ef69f89a30fb7a7874d6c3a607d874bf35
4
- data.tar.gz: 35a6b8e0c5429b648243eb6b2c17834aa216292a
3
+ metadata.gz: efd7204b29860fd75f5957d387a7e3471f29dc4f
4
+ data.tar.gz: 39171775abf2b781a075ca41dff0269ec2604b91
5
5
  SHA512:
6
- metadata.gz: c4cd9d81e9db2ff98e0386bb4ae6803ab616edd637275ee957d95302b09d13ac4a415f56e849720d2d006625a79176875601053afa31cf8d02d551f93889e772
7
- data.tar.gz: 7feec3a54880470f1a511a5817168780990c78a6129367dbdb506a03caac7a2ab7d0f853a0107b847430a8cb7b3d9a7d9b8505588e990fdaf78147040957ccf5
6
+ metadata.gz: 27bd4fe6035a627fd69303caf363ada2a5a295a02358a0d6375a26d7aa8326a0072c49af4e6c93cb4ef4fddc19d93a929ee3091a61409b95a5b508d03ef95669
7
+ data.tar.gz: 246e802642e5e7ad4c29c71bf92f826e5553f5ec2c163dec42e8f14bbcd6f6f2dd7d459c8721b6e08fae38c36f0bc4f76c3588a29841b07a5acef362571cac03
data/.travis.yml CHANGED
@@ -1,9 +1,6 @@
1
1
  ---
2
+ language: ruby
2
3
  rvm:
3
- - 2.0.0
4
- - 2.1.2
5
- - ruby-head
6
- addons:
7
- code_climate:
8
- repo_token:
9
- secure: "bogVqPmJ2KlI2XK3Ln9Ki8vG08WTvKbKfvYm4ErD1A+2t3vg61utFKxJS8R3P5QKuDDIIX98eQC7r+gPeGEYwT+tDDFMnBsGQZcaeXJCYZQ3qLN36GpnPmpeZ3tTZwop5aT1AmMCF0IllDWYCjcWzeEZan23Eqt5YOyzTGAnr4g="
4
+ - 2.4
5
+ - 2.3
6
+ script: bundle exec rspec
data/hobby.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'hobby'
7
- spec.version = '0.0.10'
7
+ spec.version = '0.0.11'
8
8
  spec.authors = ['Anatoly Chernow']
9
9
  spec.email = ['chertoly@gmail.com']
10
10
  spec.summary = %q{A minimal DSL over rack}
@@ -8,6 +8,12 @@ class Hobby::Router
8
8
  attr_reader :verb, :path
9
9
  attr_accessor :action, :params
10
10
 
11
+ def with_params params
12
+ new_route = dup
13
+ new_route.params = params
14
+ new_route
15
+ end
16
+
11
17
  alias to_proc action
12
18
  end
13
19
  end
data/lib/hobby/router.rb CHANGED
@@ -15,11 +15,7 @@ module Hobby
15
15
 
16
16
  def route_for env
17
17
  route, params = @routes["#{env['REQUEST_METHOD']}#{env['PATH_INFO']}"]
18
-
19
- route = route.dup
20
- route.params = params if params
21
-
22
- route
18
+ params ? route.with_params(params) : route
23
19
  end
24
20
  end
25
21
  end
data/spec/router_spec.rb CHANGED
@@ -46,11 +46,11 @@ describe Hobby::Router do
46
46
  assert { subject.instance_variable_get(:@routes).include? 'GET/hello/ololo' }
47
47
  end
48
48
 
49
- it 'dups a route for each request' do
49
+ it 'dups a route when requests have params' do
50
50
  router = described_class.new
51
- route = router.add_route 'GET', '/some_path' do :some_action end
51
+ route = router.add_route 'GET', '/:some_path' do :some_action end
52
52
 
53
- duped_route = router.route_for env_for '/some_path'
53
+ duped_route = router.route_for env_for '/:some_path'
54
54
 
55
55
  assert { not route.equal? duped_route }
56
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoly Chernow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-23 00:00:00.000000000 Z
11
+ date: 2017-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack