Sha256: ae2050465268be8e29f793a8f4c6179e7b12f5da0c313d7f1c4ac769d75469ed

Contents?: true

Size: 1.35 KB

Versions: 34

Compression:

Stored size: 1.35 KB

Contents

# Warnings
This documents tries to bring more information on warnings
and depreations on current versions of the gem.

## Usage of custom config classes
Introduced: 1.3.0
Changed in: 1.4.0

In the past, you could use any custom configuration classes
to configure your configurable. Those classes could be
extended through the regular usage of ```.configurable_with```
or have it's configuration attributes declared by
```with``` option on ```configurable_with```

```ruby
class MyConfig
  def url
    if @port
      "http://#{@host}:#{@port}"
    else
      "http://#{@host}"
    end
  end
end

class MyClient
  configutable_by MyConfig, with: [:host, :port]
  configurable_with timeout: 5.seconds
end

MyClient.configure do
  port 5555
  host 'myhost.com'
  timeout 10.seconds
end
```

Now, the configuration class should extend ```Sinclair::ConfigClass```
and the attributes defined within the class itself, still
being able to extend it through the usage of
```.configurable_with``` call after ```configurable_by```

```ruby
class MyConfig
  extend Sinclair::ConfigClass

  config_attributes :host, :port

  def url
    if @port
      "http://#{@host}:#{@port}"
    else
      "http://#{@host}"
    end
  end
end

class MyClient
  configutable_by MyConfig

  configurable_with timeout: 5.seconds
end

MyClient.configure do
  port 5555
  host 'myhost.com'
  timeout 10.seconds
end
```

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
sinclair-2.1.1 WARNINGS.md
sinclair-2.1.0 WARNINGS.md
sinclair-2.0.1 WARNINGS.md
sinclair-2.0.0 WARNINGS.md
sinclair-1.16.3 WARNINGS.md
sinclair-1.16.2 WARNINGS.md
sinclair-1.16.1 WARNINGS.md
sinclair-1.16.0 WARNINGS.md
sinclair-1.15.0 WARNINGS.md
sinclair-1.14.2 WARNINGS.md
sinclair-1.14.1 WARNINGS.md
sinclair-1.14.0 WARNINGS.md
sinclair-1.13.0 WARNINGS.md
sinclair-1.12.1 WARNINGS.md
sinclair-1.12.0 WARNINGS.md
sinclair-1.11.0 WARNINGS.md
sinclair-1.10.0 WARNINGS.md
sinclair-1.9.0 WARNINGS.md
sinclair-1.8.0 WARNINGS.md
sinclair-1.7.0 WARNINGS.md