README.md in sinclair-1.3.2 vs README.md in sinclair-1.3.3

- old
+ new

@@ -12,11 +12,11 @@ that enables creation of methods on the fly through class methods Yard Documentation ------------------- -https://www.rubydoc.info/gems/sinclair/1.3.2 +https://www.rubydoc.info/gems/sinclair/1.3.3 Installation --------------- - Install it @@ -328,9 +328,41 @@ MyConfigurable.reset_config MyConfigurable.config.host # returns nil MyConfigurable.config.port # returns 80 +``` + +Configurations can also be done through custom classes + +```ruby + class MyServerConfig + def url + if @port + "http://#{@host}:#{@port}" + else + "http://#{@host}" + end + end + end + + class Client + extend Sinclair::Configurable + + configurable_by MyServerConfig, with: %i[host port] + end + + Client.configure do + host 'interstella.com' + end + + Client.config.url # returns 'http://interstella.com' + + Client.configure do |config| + config.port 8080 + end + + Client.config.url # returns 'http://interstella.com:8080' ``` RSspec matcher ---------------