rutter 0.1.0 → 0.1.1

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: 2abaca05bb6b82020f84e94bad340f3b36b878f8
4
- data.tar.gz: a9ef1e6084c8ed5ac55b4fc531ddb5a72ee2ad90
3
+ metadata.gz: 6f91432538209a198ac676ddfe072b83d469b382
4
+ data.tar.gz: b8fb9fe0e6ff41ccfb91b30fe34b67a189b89c38
5
5
  SHA512:
6
- metadata.gz: 36fe83976abbe7c9b8e1f2a19af118ad6d3f261b2c48d0bae3bfaf63888ffc45ecf27ea83f9b5d859a1ff2722a4cd027fa32ef24af777d6e169f0fa43636ba5c
7
- data.tar.gz: cac8e0f2e0f2797f91f92309a69214f6e3023fd3773f6636f17188efefae64cdaef3da82b4d77c1f0c09a45f1cdf21304eaee99976f329752663fbf7efcaa313
6
+ metadata.gz: f66d79b45f86bf37aad68fa4a0374b8594d954711fef0de1b4ca738acb1e4d48269d2d16d14a85cbcda6e3a35fbddfa0fe58b3ceb04e5faa40c084fbd0081ba3
7
+ data.tar.gz: ee48cfa27b6d7e9fe557f108eeb48fab5f32647d9c4a0ee4fa7cddb6baeda25233da0e78da58b5bd79693f70f112bb56a19b2b921a54ca0a9c7efeca5b8d337d
data/.rubocop.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 2.4
3
3
  DisplayCopNames: true
4
- Exclude: []
4
+ Exclude:
5
+ - bench/*
5
6
 
6
7
  Style/StringLiterals:
7
8
  EnforcedStyle: double_quotes
data/lib/rutter/routes.rb CHANGED
@@ -26,10 +26,16 @@ module Rutter
26
26
  protected
27
27
 
28
28
  # @private
29
- def method_missing(method, *args)
30
- named_route, type = method.to_s.split(/\_(path|url)\z/)
29
+ def method_missing(method_name, *args)
30
+ named_route, type = method_name.to_s.split(/\_(path|url)\z/)
31
31
  return super unless type
32
32
  @builder.public_send(type, named_route.to_sym, *args)
33
33
  end
34
+
35
+ # @private
36
+ def respond_to_missing?(method_name, include_private = false)
37
+ meth = method_name.to_s
38
+ meth.end_with?("_path") || meth.end_with?("_url") || super
39
+ end
34
40
  end
35
41
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Rutter
4
4
  # Current version number.
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
@@ -25,5 +25,12 @@ module Rutter
25
25
  it "raises NoMethodError if unknown method is called" do
26
26
  assert_raises(NoMethodError) { routes.invalid }
27
27
  end
28
+
29
+ it "support respond_to?" do
30
+ router.get "/books/:id", to: "Books#show", as: :book
31
+ refute routes.respond_to?(:book)
32
+ assert routes.respond_to?(:book_path)
33
+ assert routes.respond_to?(:book_url)
34
+ end
28
35
  end
29
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Sandelius