much-rails 0.2.3 → 0.2.4

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
  SHA256:
3
- metadata.gz: f4834b7655c265c28bb9f46729491681daa8003dd99615c2074f27a010f22e10
4
- data.tar.gz: 70603cc1bd5717a2edf35ff23cf2fa50ae35dc494431e2fbc476388af8c3d6a1
3
+ metadata.gz: 8b0abf64ca287edfd1a6546db5766e878424a9165a661ef991ca7fda1dba6f78
4
+ data.tar.gz: 3aa006e90bb01924786952077cb5a72c595bb1c0fa28e4f32f3701063fc2ac06
5
5
  SHA512:
6
- metadata.gz: d3e614697001a8f9dd5d09a78dcfa3c5e4f6fb458406a7af6c018d7a829687b74c1a98c673ef3e62ec8f7a28f85e4a59f4b3bd7c01ccb95b4ff0d661f569cb61
7
- data.tar.gz: dcd670e7ca04b1394a92a8a9a7a55b31fd825f5f99bf0282a18d4907e7f614536f30195756ceda6b4320a2fec0d073caf96ab5b74aa57428e4331a1c73381cd7
6
+ metadata.gz: 92884c3070b8cbaf78ff384b7ea4bc12476ee175a56e73b4ea58431f84c3539c1d27d97e180b9ddcfbc16ba908127a6783c72f3716890ac5e879773dde7ff4e1
7
+ data.tar.gz: '0755183185e5f64a4c0e289e31d6bf0545438c96631847f306f83c0aa588308d215583ab2249e856c35592162438dc8cc4315ac959bb478a14baa9aa5c08584f'
@@ -70,8 +70,8 @@ class MuchRails::Action::BaseRouter
70
70
  # url :users, "/users", "Users::Index"
71
71
  # }
72
72
  # AdminRouter.path_for(:users) # => "/admin/users"
73
- def path_for(name, *args)
74
- @url_set.path_for(name, *args)
73
+ def path_for(name, **kargs)
74
+ @url_set.path_for(name, **kargs)
75
75
  end
76
76
 
77
77
  # Example:
@@ -87,8 +87,8 @@ class MuchRails::Action::BaseRouter
87
87
  # url :users, "/users", "Users::Index"
88
88
  # }
89
89
  # AdminRouter.url_for(:users) # => "http://example.org/admin/users"
90
- def url_for(name, *args)
91
- @url_set.url_for(name, *args)
90
+ def url_for(name, **kargs)
91
+ @url_set.url_for(name, **kargs)
92
92
  end
93
93
 
94
94
  # Example:
@@ -350,12 +350,12 @@ class MuchRails::Action::BaseRouter
350
350
  end
351
351
  end
352
352
 
353
- def path_for(name, *args)
354
- fetch(name).path_for(*args)
353
+ def path_for(name, **kargs)
354
+ fetch(name).path_for(**kargs)
355
355
  end
356
356
 
357
- def url_for(name, *args)
358
- fetch(name).url_for(*args)
357
+ def url_for(name, **kargs)
358
+ fetch(name).url_for(**kargs)
359
359
  end
360
360
  end
361
361
 
@@ -396,11 +396,11 @@ class MuchRails::Action::BaseRouter
396
396
  self.class.url_path(@router, @url_path)
397
397
  end
398
398
 
399
- def path_for(*args)
399
+ def path_for(**kargs)
400
400
  raise NotImplementedError
401
401
  end
402
402
 
403
- def url_for(*args)
403
+ def url_for(**kargs)
404
404
  raise NotImplementedError
405
405
  end
406
406
 
@@ -90,12 +90,18 @@ class MuchRails::Action::Router < MuchRails::Action::BaseRouter
90
90
  alias_method :draw, :apply_to
91
91
 
92
92
  class URL < MuchRails::Action::BaseRouter::BaseURL
93
- def path_for(*args)
94
- MuchRails::RailsRoutes.instance.public_send("#{name}_path", *args)
93
+ def path_for(**kargs)
94
+ MuchRails::RailsRoutes.instance.public_send(
95
+ "#{name}_path",
96
+ **kargs.symbolize_keys,
97
+ )
95
98
  end
96
99
 
97
- def url_for(*args)
98
- MuchRails::RailsRoutes.instance.public_send("#{name}_url", *args)
100
+ def url_for(**kargs)
101
+ MuchRails::RailsRoutes.instance.public_send(
102
+ "#{name}_url",
103
+ **kargs.symbolize_keys,
104
+ )
99
105
  end
100
106
  end
101
107
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuchRails
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.4"
5
5
  end
@@ -80,13 +80,13 @@ class MuchRails::Action::BaseRouter
80
80
  end
81
81
 
82
82
  should "build path/URL strings for named URLs" do
83
- path_string = subject.path_for(:url1, "TEST PATH ARGS")
83
+ path_string = subject.path_for(:url1, test: "args")
84
84
  assert_that(path_string).equals("TEST PATH STRING")
85
- assert_that(@url_set_path_for_call.args).equals([:url1, "TEST PATH ARGS"])
85
+ assert_that(@url_set_path_for_call.args).equals([:url1, { test: "args" }])
86
86
 
87
- url_string = subject.url_for(:url1, "TEST URL ARGS")
87
+ url_string = subject.url_for(:url1, test: "args")
88
88
  assert_that(url_string).equals("TEST URL STRING")
89
- assert_that(@url_set_url_for_call.args).equals([:url1, "TEST URL ARGS"])
89
+ assert_that(@url_set_url_for_call.args).equals([:url1, { test: "args" }])
90
90
  end
91
91
 
92
92
  should "define request types" do
@@ -380,13 +380,13 @@ class MuchRails::Action::BaseRouter
380
380
 
381
381
  subject.add(:url1, Factory.url)
382
382
 
383
- path_string = subject.path_for(:url1, "TEST PATH ARGS")
383
+ path_string = subject.path_for(:url1, test: "args")
384
384
  assert_that(path_string).equals("TEST PATH STRING")
385
- assert_that(@url_path_for_call.args).equals(["TEST PATH ARGS"])
385
+ assert_that(@url_path_for_call.args).equals([{ test: "args" }])
386
386
 
387
- url_string = subject.url_for(:url1, "TEST URL ARGS")
387
+ url_string = subject.url_for(:url1, test: "args")
388
388
  assert_that(url_string).equals("TEST URL STRING")
389
- assert_that(@url_url_for_call.args).equals(["TEST URL ARGS"])
389
+ assert_that(@url_url_for_call.args).equals([{ test: "args" }])
390
390
  end
391
391
  end
392
392
 
@@ -450,8 +450,8 @@ class MuchRails::Action::BaseRouter
450
450
  assert_that(subject.path)
451
451
  .equals(base_url_class.url_path(router1, url_path1))
452
452
 
453
- assert_that{ subject.path_for("TEST ARGS") }.raises(NotImplementedError)
454
- assert_that{ subject.url_for("TEST ARGS") }.raises(NotImplementedError)
453
+ assert_that{ subject.path_for(test: "args") }.raises(NotImplementedError)
454
+ assert_that{ subject.url_for(test: "args") }.raises(NotImplementedError)
455
455
  end
456
456
  end
457
457
 
@@ -206,15 +206,15 @@ class MuchRails::Action::Router
206
206
  should have_imeths :path_for, :url_for
207
207
 
208
208
  should "know its attributes" do
209
- path_string = subject.path_for("TEST PATH ARGS")
209
+ path_string = subject.path_for(test: "args")
210
210
  assert_that(path_string).equals("TEST PATH OR URL STRING")
211
211
  assert_that(@rails_routes_method_missing_call.args)
212
- .equals(["#{url_name1}_path".to_sym, "TEST PATH ARGS"])
212
+ .equals(["#{url_name1}_path".to_sym, { test: "args" }])
213
213
 
214
- url_string = subject.url_for("TEST URL ARGS")
214
+ url_string = subject.url_for(test: "args")
215
215
  assert_that(url_string).equals("TEST PATH OR URL STRING")
216
216
  assert_that(@rails_routes_method_missing_call.args)
217
- .equals(["#{url_name1}_url".to_sym, "TEST URL ARGS"])
217
+ .equals(["#{url_name1}_url".to_sym, { test: "args" }])
218
218
  end
219
219
  end
220
220
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: much-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-02-08 00:00:00.000000000 Z
12
+ date: 2021-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: much-style-guide