tanshuku 0.0.13 → 0.0.15

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: 1748ebeb12ae7c094ef0cd34386f6db676b8363c50423b39bf571e92093a1217
4
- data.tar.gz: c9d4513adbf7bd8e87d1d218801b108c7a72e4681185d4b7f60705eefff722ce
3
+ metadata.gz: 0324af7c609277e8e090c37de67cb5c6c86cfd6e72944f6b04d36f58e241e76f
4
+ data.tar.gz: '08ff837c3b7a985ab8cdc849b0bc2b8bda659b4863d5e2b6a6c1c10a8676c977'
5
5
  SHA512:
6
- metadata.gz: b18fa0edf40682988bf7c51055f2a59cc100af34ea50ccf52bd9ca320b34a95dd76f9bd864f57e98e4909dbec904da954e02d0b1e4cadd2ff42119f1956cee47
7
- data.tar.gz: 0fa9fe03d277660ba8d440429f8f58686d3587dc09db02788ffc79ddeff2e34ef995500b0fde39e19cb841f026e7ce4b918c06ff504120fbf4203bae54cfbe5f
6
+ metadata.gz: 9750293fcc5dc6baeb2cc5b3e6ab535a4207c6aaaba0a9c9dfa1647134ed04ac48421d87ef85261210618628ecbf36b654ccc63216ed9e769f062e701f1e5611
7
+ data.tar.gz: dcbf6e0c7cdda1284d5fadd1a7c9c96beb513e595c94e23902973634035d7c7ff5adbe145406f4cfdf22e5fe8a6c85fea6ba67bd8f95e03a569dae1692584823
data/README.md CHANGED
@@ -31,7 +31,9 @@ end
31
31
 
32
32
  **Note**: This step is optional.
33
33
 
34
- **Note**: The initializer file can be generated by `bin/rails generate tanshuku:install`. See the "[Installation](#installation)" section for more information.
34
+ **Note**: An initializer file for configuration can be generated by `bin/rails generate tanshuku:install`. See the "[Installation](#installation)" section below for more information.
35
+
36
+ **Note**: Mutating a `Tanshuku::Configuration` object is thread-***unsafe***. It is recommended to use `Tanshuku.configure` for configuration.
35
37
 
36
38
  #### `config.default_url_options`
37
39
 
@@ -52,7 +54,7 @@ end
52
54
 
53
55
  If an exception occurs when shortening a URL, Tanshuku reports it with configured `config.exception_reporter` object.
54
56
 
55
- Default value is `Tanshuku::Configuration::DefaultExceptionReporter`. It logs the exception and the original URL with `Rails.logger.warn`.
57
+ Default value is [`Tanshuku::Configuration::DefaultExceptionReporter`](https://kg8m.github.io/tanshuku/Tanshuku/Configuration/DefaultExceptionReporter.html). It logs the exception and the original URL with `Rails.logger.warn`.
56
58
 
57
59
  Value of `config.exception_reporter` should respond to `#call` with keyword arguments `exception:` and `original_url:`.
58
60
 
@@ -68,6 +70,10 @@ Tanshuku.configure do |config|
68
70
  end
69
71
  ```
70
72
 
73
+ #### More information
74
+
75
+ cf. [`Tanshuku::Configuration`'s API documentation](https://kg8m.github.io/tanshuku/Tanshuku/Configuration.html)
76
+
71
77
  ### 3. Generate shortened URLs
72
78
 
73
79
  #### Basic cases
@@ -78,7 +84,7 @@ You can generate a shortened URL with `Tanshuku::Url.shorten`. For example:
78
84
  Tanshuku::Url.shorten("https://google.com/") #=> "https://example.com/t/abcdefghij0123456789"
79
85
  ```
80
86
 
81
- [`config.default_url_options`](#configdefault_url_options) is used for the shortened URL.
87
+ [`config.default_url_options`](https://kg8m.github.io/tanshuku/Tanshuku/Configuration.html#default_url_options-instance_method) is used for the shortened URL.
82
88
 
83
89
  **Note**: If a `Tanshuku::Url` record for the given URL already exists, no additional record will be created and always the existing record is used.
84
90
 
@@ -123,6 +129,10 @@ Tanshuku::Url.shorten("https://google.com/", namespace: "a") #=> "https://examp
123
129
  Tanshuku::Url.shorten("https://google.com/", namespace: "a") #=> "https://example.com/t/ab01cd23ef45gh67ij89"
124
130
  ```
125
131
 
132
+ #### More information
133
+
134
+ cf. [`Tanshuku::Url.shorten`'s API documentation](https://kg8m.github.io/tanshuku/Tanshuku/Url.html#shorten-class_method)
135
+
126
136
  ### 4. Share the shortened URLs
127
137
 
128
138
  You can share the shortened URLs, e.g., `https://example.com/t/abcdefghij0123456789`.
@@ -165,3 +175,20 @@ bin/rails db:migrate
165
175
  ### \*\* (anything you want) isn't implemented?
166
176
 
167
177
  Does Tanshuku have some missing features? Please [create an issue](https://github.com/kg8m/tanshuku/issues/new).
178
+
179
+ ## How to develop
180
+
181
+ 1. Fork this repository
182
+ 1. `git clone` your fork
183
+ 1. `bundle install`
184
+ 1. Update sources
185
+ 1. `rake`
186
+ 1. Fix `rake` errors if `rake` fails
187
+ 1. Create a pull request
188
+
189
+ ## How to release
190
+
191
+ 1. Make your repository fresh
192
+ 1. `bump current` and confirm the current version
193
+ 1. `bump patch`, `bump minor`, or `bump major`
194
+ 1. `rake release`
data/Rakefile CHANGED
@@ -20,6 +20,11 @@ namespace :yard do
20
20
  puts "See http://localhost:8808/"
21
21
  sh "yard server --reload"
22
22
  end
23
+
24
+ desc "Check YARD docs"
25
+ task :check do
26
+ sh "yard --no-output --no-cache --fail-on-warning"
27
+ end
23
28
  end
24
29
 
25
- task default: %i[rubocop spec]
30
+ task default: %i[rubocop spec yard:check]
@@ -2,22 +2,30 @@
2
2
 
3
3
  require "active_record"
4
4
  require "addressable"
5
- require "digest/sha2"
6
5
  require "rack"
7
- require "securerandom"
8
6
 
9
7
  module Tanshuku
10
8
  # An +ActiveRecord::Base+ inherited class for a shortened URL. This class also have some logics for shortening URLs.
11
9
  class Url < ActiveRecord::Base
12
- DEFAULT_NAMESPACE = ""
10
+ # @!attribute [rw] url
11
+ # @return [String] Original, i.e., non-shortened, URL of the record.
12
+ #
13
+ # @!attribute [rw] hashed_url
14
+ # @return [String] A hashed string of the record's original URL.
15
+ # @note This attribute is used for uniqueness of the original URL.
16
+ # @api private
17
+ #
18
+ # @!attribute [rw] key
19
+ # @return [String] A unique key for the record.
20
+ #
21
+ # @!attribute [rw] created_at
22
+ # @return [ActiveSupport::TimeWithZone] A timestamp when the record is created.
13
23
 
14
- MAX_URL_LENGTH = 10_000
15
- URL_PATTERN = %r{\A(?:https?://\w+|/)}
16
- KEY_LENGTH = 20
24
+ DEFAULT_NAMESPACE = ""
17
25
 
18
26
  validates :url, :hashed_url, :key, presence: true
19
- validates :url, length: { maximum: MAX_URL_LENGTH }
20
- validates :url, format: { with: URL_PATTERN }, allow_blank: true
27
+ validates :url, length: { maximum: proc { Tanshuku.config.max_url_length } }
28
+ validates :url, format: { with: proc { Tanshuku.config.url_pattern } }, allow_blank: true
21
29
 
22
30
  # Don't validate uniqueness of unique attributes. Raise ActiveRecord::RecordNotUnique instead if the attributes get
23
31
  # duplicated. Then rescue the exception and try to retry.
@@ -34,8 +42,8 @@ module Tanshuku
34
42
  # +shorten("https://google.com")+ have the same result.
35
43
  #
36
44
  # @param original_url [String] The original, i.e., non-shortened, URL.
37
- # @param namespace: [String] A namespace for shorteting URL. Shortened URLs are unique in namespaces.
38
- # @param url_options: [Hash] An option for Rails' +url_for+.
45
+ # @param namespace [String] A namespace for shorteting URL. Shortened URLs are unique in namespaces.
46
+ # @param url_options [Hash] An option for Rails' +url_for+.
39
47
  #
40
48
  # @return [String] A shortened URL if succeeded to shorten the original URL.
41
49
  # @return [String] The original URL if failed to shorten it.
@@ -44,6 +52,25 @@ module Tanshuku
44
52
  # Tanshuku::Url.shorten("https://google.com/") #=> "http://localhost/t/abcdefghij0123456789"
45
53
  # @example If failed to shorten a URL.
46
54
  # Tanshuku::Url.shorten("https://google.com/") #=> "https://google.com/"
55
+ # @example With ad hoc URL options.
56
+ # Tanshuku::Url.shorten("https://google.com/", url_options: { host: "verycool.example.com" })
57
+ # #=> "https://verycool.example.com/t/0123456789abcdefghij"
58
+ #
59
+ # Tanshuku::Url.shorten("https://google.com/", url_options: { protocol: :http })
60
+ # #=> "http://example.com/t/abcde01234fghij56789"
61
+ # @example With a namespace.
62
+ # # When no record exists for "https://google.com/", a new record will be created.
63
+ # Tanshuku::Url.shorten("https://google.com/") #=> "https://example.com/t/abc012def345ghi678j9"
64
+ #
65
+ # # Even when a record already exists for "https://google.com/", an additional record will be created if namespace
66
+ # # is specified.
67
+ # Tanshuku::Url.shorten("https://google.com/", namespace: "a") #=> "https://example.com/t/ab01cd23ef45gh67ij89"
68
+ # Tanshuku::Url.shorten("https://google.com/", namespace: "b") #=> "https://example.com/t/a0b1c2d3e4f5g6h7i8j9"
69
+ # Tanshuku::Url.shorten("https://google.com/", namespace: "c") #=> "https://example.com/t/abcd0123efgh4567ij89"
70
+ #
71
+ # # When the same URL and the same namespace is specified, no additional record will be created.
72
+ # Tanshuku::Url.shorten("https://google.com/", namespace: "a") #=> "https://example.com/t/ab01cd23ef45gh67ij89"
73
+ # Tanshuku::Url.shorten("https://google.com/", namespace: "a") #=> "https://example.com/t/ab01cd23ef45gh67ij89"
47
74
  def self.shorten(original_url, namespace: DEFAULT_NAMESPACE, url_options: {})
48
75
  raise ArgumentError, "original_url should be present" unless original_url
49
76
 
@@ -77,10 +104,10 @@ module Tanshuku
77
104
  # Finds a {Tanshuku::Url} record by a non-shortened URL.
78
105
  #
79
106
  # @param url [String] A non-shortened URL.
80
- # @param namespace: [String] A namespace for the URL.
107
+ # @param namespace [String] A namespace for the URL.
81
108
  #
82
109
  # @return [Tanshuku::Url] A {Tanshuku::Url} instance if found.
83
- # @reutnr [nil] +nil+ unless found.
110
+ # @return [nil] +nil+ unless found.
84
111
  def self.find_by_url(url, namespace: DEFAULT_NAMESPACE)
85
112
  normalized_url = normalize_url(url)
86
113
  hashed_url = hash_url(normalized_url, namespace:)
@@ -100,31 +127,35 @@ module Tanshuku
100
127
  parsed_url.normalize.to_s
101
128
  end
102
129
 
103
- # Hashes a URL with +Digest::SHA512.hexdigest+.
130
+ # Hashes a URL.
131
+ #
132
+ # @note This method calls {Tanshuku::Configuration#url_hasher}'s +call+ and returns its return value.
104
133
  #
105
134
  # @param url [String] A non-hashed URL.
106
- # @param namespace: [String] A namespace for the URL.
135
+ # @param namespace [String] A namespace for the URL.
107
136
  #
108
- # @return [String] A hashed 128-character string.
137
+ # @return [String] Depends on your {Tanshuku::Configuration#url_hasher} configuration.
109
138
  def self.hash_url(url, namespace: DEFAULT_NAMESPACE)
110
- Digest::SHA512.hexdigest(namespace.to_s + url)
139
+ Tanshuku.config.url_hasher.call(url, namespace:)
111
140
  end
112
141
 
113
- # Generates a key with +SecureRandom.alphanumeric+.
142
+ # Generates a unique key for a shortened URL.
143
+ #
144
+ # @note This method calls {Tanshuku::Configuration#key_generator}'s +call+ and returns its return value.
114
145
  #
115
- # @return [String] A 20-character alphanumeric string.
146
+ # @return [String] Depends on your {Tanshuku::Configuration#key_generator} configuration.
116
147
  def self.generate_key
117
- SecureRandom.alphanumeric(KEY_LENGTH)
148
+ Tanshuku.config.key_generator.call
118
149
  end
119
150
 
120
151
  # Reports an exception when failed to shorten a URL.
121
152
  #
122
153
  # @note This method calls {Tanshuku::Configuration#exception_reporter}'s +call+ and returns its return value.
123
154
  #
124
- # @param exception: [Exception] An error instance at shortening a URL.
125
- # @param original_url: [String] The original URL failed to shorten.
155
+ # @param exception [Exception] An error instance at shortening a URL.
156
+ # @param original_url [String] The original URL failed to shorten.
126
157
  #
127
- # @return [void]
158
+ # @return [void] Depends on your {Tanshuku::Configuration#exception_reporter} configuration.
128
159
  def self.report_exception(exception:, original_url:)
129
160
  Tanshuku.config.exception_reporter.call(exception:, original_url:)
130
161
  end
@@ -1,14 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "digest/sha2"
4
+ require "securerandom"
5
+
3
6
  module Tanshuku
4
7
  # A class for managing Tanshuku configurations.
5
8
  class Configuration
9
+ # The default object to hash a URL. Calls +Digest::SHA512.hexdigest+.
10
+ module DefaultUrlHasher
11
+ # Calls +Digest::SHA512.hexdigest+ with the given URL string and the given namespace.
12
+ #
13
+ # @param url [String] A URL to hash.
14
+ # @param namespace [String] A namespace for the URL's uniqueness.
15
+ #
16
+ # @return [String] A SHA512 digest string from the given url and namespace.
17
+ def self.call(url, namespace:)
18
+ Digest::SHA512.hexdigest("#{namespace}#{url}")
19
+ end
20
+ end
21
+
22
+ # The default unique key generator. Calls +SecureRandom.alphanumeric+ with {Tanshuku::Configuration#key_length}.
23
+ module DefaultKeyGenerator
24
+ # Calls +SecureRandom.alphanumeric+ and returns a string with length of {Tanshuku::Configuration#key_length}.
25
+ #
26
+ # @return [String] An alphanumeric string with length of {Tanshuku::Configuration#key_length}.
27
+ def self.call
28
+ SecureRandom.alphanumeric(Tanshuku.config.key_length)
29
+ end
30
+ end
31
+
6
32
  # The default error-reporter. Calls +Rails.logger.warn+.
7
33
  module DefaultExceptionReporter
8
- # The default error-reporting procedure. Calls +Rails.logger.warn+.
34
+ # Calls +Rails.logger.warn+ and logs the exception and the original URL.
9
35
  #
10
- # @param exception: [Exception] An error instance at shortening a URL.
11
- # @param original_url: [String] The original URL failed to shorten.
36
+ # @param exception [Exception] An error instance at shortening a URL.
37
+ # @param original_url [String] The original URL failed to shorten.
12
38
  #
13
39
  # @return [void]
14
40
  def self.call(exception:, original_url:)
@@ -23,15 +49,147 @@ module Tanshuku
23
49
  #
24
50
  # @return [Hash]
25
51
  # @return [void] If you set an invalid object.
52
+ #
53
+ # @note
54
+ # The example below means that the configured host and protocol are used. Shortened URLs will be like
55
+ # +https://example.com/t/abcdefghij0123456789+.
56
+ #
57
+ # @example
58
+ # # config/initializers/tanshuku.rb
59
+ # Tanshuku.configure do |config|
60
+ # config.default_url_options = { host: "example.com", protocol: :https }
61
+ # end
26
62
  attribute :default_url_options, default: {}
27
63
 
64
+ # @!attribute [rw] max_url_length
65
+ # Maximum length of {Tanshuku::Url#url}. Defaults to +10,000+.
66
+ #
67
+ # @return [Integer]
68
+ # @return [void] If you set an invalid object.
69
+ #
70
+ # @note
71
+ # The example below means that {Tanshuku::Url#url} can have a URL string with less than or equal to 20,000
72
+ # characters.
73
+ #
74
+ # @example
75
+ # # config/initializers/tanshuku.rb
76
+ # Tanshuku.configure do |config|
77
+ # config.max_url_length = 20_000
78
+ # end
79
+ attribute :max_url_length, :integer, default: 10_000
80
+
81
+ # @!attribute [rw] url_pattern
82
+ # Allowed pattern of {Tanshuku::Url#url}. Defaults to <code>%r{\A(?:https?://\w+|/)}</code>. This default value
83
+ # forces a URL to start with "http://" or "https://", or to be an absolute path without scheme.
84
+ #
85
+ # @return [Regexp]
86
+ # @return [void] If you set an invalid object.
87
+ #
88
+ # @note
89
+ # The example below means that {Tanshuku::Url#url} should start with a slash +/+.
90
+ #
91
+ # @example
92
+ # # config/initializers/tanshuku.rb
93
+ # Tanshuku.configure do |config|
94
+ # config.url_pattern = /\A\//
95
+ # end
96
+ attribute :url_pattern, default: %r{\A(?:https?://\w+|/)}
97
+
98
+ # @!attribute [rw] key_length
99
+ # Length of {Tanshuku::Url#key} when {Tanshuku::Configuration#key_generator} is
100
+ # {Tanshuku::Configuration::DefaultKeyGenerator}. Defaults to +20+.
101
+ #
102
+ # @return [Integer]
103
+ # @return [void] If you set an invalid object.
104
+ #
105
+ # @note Don't forget to fix the limit of the +tanshuku_urls.key+ column if you change this value.
106
+ #
107
+ # @note
108
+ # The example below means that {Tanshuku::Url#key} has 10-char string.
109
+ #
110
+ # @example
111
+ # # config/initializers/tanshuku.rb
112
+ # Tanshuku.configure do |config|
113
+ # config.key_length = 10
114
+ # end
115
+ attribute :key_length, :integer, default: 20
116
+
117
+ # @!attribute [rw] url_hasher
118
+ # A class, module, or object to hash a URL. This should respond to +#call+ with a required positional argument
119
+ # +url+ and a required keyword argument +namespace:+. Defaults to {Tanshuku::Configuration::DefaultUrlHasher}.
120
+ #
121
+ # @return [#call]
122
+ # A class, module, or object that responds to +#call+ with a required positional argument +url+ and a required
123
+ # keyword argument +namespace:+.
124
+ # @return [void] If you set an invalid object.
125
+ #
126
+ # @note The example below means that URLs are hashed with +Digest::SHA256.hexdigest+.
127
+ #
128
+ # @example
129
+ # # config/initializers/tanshuku.rb
130
+ # Tanshuku.configure do |config|
131
+ # config.url_hasher = ->(url, namespace:) { Digest::SHA256.hexdigest("#{namespace}#{url}") }
132
+ # end
133
+ attribute :url_hasher, default: DefaultUrlHasher
134
+
135
+ # @!attribute [rw] key_generator
136
+ # A class, module, or object to generate a unique key for shortened URLs. This should respond to +#call+ without
137
+ # any arguments. Defaults to {Tanshuku::Configuration::DefaultKeyGenerator}.
138
+ #
139
+ # @return [#call]
140
+ # A class, module, or object that responds to +#call+ without any arguments.
141
+ # @return [void] If you set an invalid object.
142
+ #
143
+ # @note The example below means that unique keys for shortened URLs are generated by +SecureRandom.uuid+.
144
+ #
145
+ # @example
146
+ # # config/initializers/tanshuku.rb
147
+ # Tanshuku.configure do |config|
148
+ # config.key_generator = -> { SecureRandom.uuid }
149
+ # end
150
+ attribute :key_generator, default: DefaultKeyGenerator
151
+
28
152
  # @!attribute [rw] exception_reporter
29
- # A error-reporter class, module, or object used when shortening a URL fails. This should respond to +#call+.
30
- # Defaults to {Tanshuku::Configuration::DefaultExceptionReporter}.
153
+ # A error-reporter class, module, or object used when shortening a URL fails. This should respond to +#call+ with
154
+ # required keyword arguments +exception:+ and +original_url:+. Defaults to
155
+ # {Tanshuku::Configuration::DefaultExceptionReporter}.
31
156
  #
32
- # @return [Tanshuku::Configuration::DefaultExceptionReporter, #call]
33
- # A +Tanshuku::Configuration::DefaultExceptionReporter+ instance or an object that responds to +#call+.
157
+ # @return [#call]
158
+ # A class, module, or object that responds to +#call+ with required keyword arguments +exception:+ and
159
+ # +original_url:+.
34
160
  # @return [void] If you set an invalid object.
161
+ #
162
+ # @note The example below means that an exception and a URL will be reported to Sentry (https://sentry.io).
163
+ #
164
+ # @example
165
+ # # config/initializers/tanshuku.rb
166
+ # Tanshuku.configure do |config|
167
+ # config.exception_reporter =
168
+ # lambda { |exception:, original_url:|
169
+ # Sentry.capture_exception(exception, tags: { original_url: })
170
+ # }
171
+ # end
35
172
  attribute :exception_reporter, default: DefaultExceptionReporter
173
+
174
+ def initialize(...)
175
+ super
176
+ @mutex = Mutex.new
177
+ end
178
+
179
+ # Configures Tanshuku thread-safely.
180
+ #
181
+ # @yieldparam config [Tanshuku::Configuration] A configuration object that is yielded.
182
+ # @yieldreturn [void]
183
+ #
184
+ # @return [void]
185
+ #
186
+ # @note Use {Tanshuku.configure} as a public API for configuration.
187
+ #
188
+ # @api private
189
+ def configure
190
+ @mutex.synchronize do
191
+ yield self
192
+ end
193
+ end
36
194
  end
37
195
  end
@@ -2,6 +2,18 @@
2
2
 
3
3
  module Tanshuku
4
4
  # Tanshuku's Rails engine.
5
+ #
6
+ # @note
7
+ # The example below generates a routing +GET `/t/:key` to `Tanshuku::UrlsController#show`+. When your Rails app
8
+ # receives a request to +/t/abcdefghij0123456789+, +Tanshuku::UrlsController#show+ will be called and a
9
+ # +Tanshuku::Url+ record with a key +abcdefghij0123456789+ will be found. Then the request will be redirected to the
10
+ # +Tanshuku::Url+ record's original URL.
11
+ #
12
+ # @example To mount Tanshuku to your Rails app
13
+ # # config/routes.rb
14
+ # Rails.application.routes.draw do
15
+ # mount Tanshuku::Engine, at: "/t"
16
+ # end
5
17
  class Engine < ::Rails::Engine
6
18
  isolate_namespace Tanshuku
7
19
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tanshuku
4
- VERSION = "0.0.13"
4
+ VERSION = "0.0.15"
5
5
  end
data/lib/tanshuku.rb CHANGED
@@ -9,10 +9,15 @@ module Tanshuku
9
9
  # Returns a configuration object for Tanshuku.
10
10
  #
11
11
  # @return [Tanshuku::Configuration]
12
+ #
13
+ # @note
14
+ # Mutating a {Tanshuku::Configuration} object is thread-<em><b>unsafe</b></em>. It is recommended to use
15
+ # {Tanshuku.configure} for configuration.
12
16
  def self.config
13
- Mutex.new.synchronize do
14
- @config ||= Configuration.new
15
- end
17
+ # Disable this cop but use `Tanshuku::Configuration#configure` for thread-safety.
18
+ # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
19
+ @config ||= Configuration.new
20
+ # rubocop:enable ThreadSafety/InstanceVariableInClassMethod
16
21
  end
17
22
 
18
23
  # Configures Tanshuku.
@@ -22,11 +27,15 @@ module Tanshuku
22
27
  #
23
28
  # @return [void]
24
29
  #
30
+ # @note
31
+ # This method is thread-safe. When mutating a {Tanshuku::Configuration} object for configuration, it is recommended
32
+ # to use this method.
33
+ #
25
34
  # @example
26
35
  # Tanshuku.configure do |config|
27
36
  # config.default_url_options = { host: "localhost", protocol: :https }
28
37
  # end
29
- def self.configure
30
- yield config
38
+ def self.configure(&)
39
+ config.configure(&)
31
40
  end
32
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tanshuku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - kg8m
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-22 00:00:00.000000000 Z
11
+ date: 2023-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -70,6 +70,7 @@ metadata:
70
70
  homepage_uri: https://github.com/kg8m/tanshuku
71
71
  source_code_uri: https://github.com/kg8m/tanshuku
72
72
  changelog_uri: https://github.com/kg8m/tanshuku/releases
73
+ documentation_uri: https://kg8m.github.io/tanshuku/
73
74
  rubygems_mfa_required: 'true'
74
75
  post_install_message:
75
76
  rdoc_options: []