README.md in basic_serializer-0.1.4 vs README.md in basic_serializer-0.1.5
- old
+ new
@@ -15,23 +15,28 @@
## Usage
```ruby
class UserSerializer < BasicSerializer
- attribute :id, :integer
- attribute :name, :string
- attribute :email, :string
+ attribute :id, :integer # attribute definition
+ attribute :name, :string # attribute definition
+ attribute :email, :string # attribute definition
- format :json, pretty: true
+ format :json, pretty: true # output format and options
- model_name "User" # optional model name metadata
+ model_name "User" # optional model name metadata
schema_ref "#/components/schemas/User" # optional swagger schema reference
end
serializer = UserSerializer.new(name: 'Foobar', email: 'email@domain.com', id: 1)
-serializer.to_json
-serializer.to_yaml
serializer.serialize
+```
+```json
+{
+ "id": 1,
+ "name": "Foobar",
+ "email": "email@domain.com"
+}
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.