README.md in smart_initializer-0.2.0 vs README.md in smart_initializer-0.3.0
- old
+ new
@@ -10,23 +10,25 @@
```
```shell
bundle install
# --- or ---
-gem install smart_types
+gem install smart_initializer
```
```ruby
-require 'smart_core/types'
+require 'smart_core/initializer'
```
---
## Table of contents
- [Synopsis](#synopsis)
-- [Type Aliasing](#type-aliasing)
+- [Access to the instance attributes](#access-to-the-instance-attributes)
+- [Configuration](#configuration)
+- [Type aliasing](#type-aliasing)
- [Initialization extension](#initialization-extension)
- [Plugins](#plugins)
- [thy-types](#plugin-thy-types)
- [How to run tests](#how-to-run-tests)
@@ -120,10 +122,35 @@
User.new(1, 'John', 'test123', role: :admin, metadata: {}, enabled: false)
```
---
+## Access to the instance attributes
+
+- `#__params__` - returns a list of initialized params;
+- `#__options__` - returns a list of initialized options;
+- `#__attributes__` - returns a list of merged params and options;
+
+```ruby
+class User
+ include SmartCore::Initializer
+
+ param :first_name, 'string'
+ param :second_name, 'string'
+ option :age, 'numeric'
+ option :is_admin, 'boolean', default: true
+end
+
+user = User.new('Rustam', 'Ibragimov', age: 28)
+
+user.__params__ # => { first_name: 'Rustam', second_name: 'Ibragimov' }
+user.__options__ # => { age: 28, is_admin: true }
+user.__attributes__ # => { first_name: 'Rustam', second_name: 'Ibragimov', age: 28, is_admin: true }
+```
+
+---
+
## Configuration
- based on `Qonfig` gem;
- you can read config values via `[]` or `.config.settings` or `.config[key]`;
- setitngs:
@@ -181,10 +208,11 @@
## Initialization extension
- `ext_init(&block)`:
- you can define as many extensions as you want;
- extensions are invoked in the order they are defined;
+ - alias method: `extend_initialization_flow`;
```ruby
class User
include SmartCore::Initializer
@@ -267,10 +295,10 @@
```
- without plugin tests:
```shell
-bin/rspec -g
+bin/rspec -n
```
- help message:
```shell