README.md in qonfig-0.5.0 vs README.md in qonfig-0.6.0
- old
+ new
@@ -518,22 +518,22 @@
```ruby
# --- strict mode ---
class Config < Qonfig::DataSet
setting :nonexistent_json do
- load_from_yaml 'nonexistent_json.json', strict: true # true by default
+ load_from_json 'nonexistent_json.json', strict: true # true by default
end
setting :another_key
end
Config.new # => Qonfig::FileNotFoundError
# --- non-strict mode ---
class Config < Qonfig::DataSet
settings :nonexistent_json do
- load_from_yaml 'nonexistent_json.json', strict: false
+ load_from_json 'nonexistent_json.json', strict: false
end
setting :another_key
end
@@ -659,10 +659,11 @@
- `.config` - config object;
- settings definitions are inheritable;
- instance-level:
- `#configure` - configuration;
- `#config` - config object;
+ - `#shared_config` - class-level config object;
```ruby
# --- usage ---
class Application
@@ -683,10 +684,14 @@
# instance-level config
app.config.settings.user # => nil
app.config.settings.password # => nil
+# access to the class level config from an instance
+app.shared_config.settings.user # => nil
+app.shared_config.settings.password # => nil
+
# class-level configuration
Application.configure do |conf|
conf.user = '0exp'
conf.password = 'test123'
end
@@ -702,9 +707,13 @@
Application.config.settings.password # => 'test123'
# instance has own config object
app.config.settings.user # => 'admin'
app.config.settings.password # => '123test'
+
+# access to the class level config from an instance
+app.shared_config.settings.user # => '0exp'
+app.shared_config.settings.password # => 'test123'
# and etc... (all Qonfig-related features)
```
```ruby