Skip to content

Commit 04a240a

Browse files
committed
Merge pull request #1105 from ddzz/small-readme-fix
Minor clarifications to declared parameters section
2 parents 915de58 + 639f055 commit 04a240a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ route string parameters will have precedence.
487487

488488
#### Declared
489489

490-
Grape allows you to access only the parameters that have been declared by your `params` block. It filters out the params that have been passed, but are not allowed. Let's have the following api:
490+
Grape allows you to access only the parameters that have been declared by your `params` block. It filters out the params that have been passed, but are not allowed. Consider the following API endpoint:
491491

492492
````ruby
493493
format :json
@@ -497,7 +497,7 @@ post 'users/signup' do
497497
end
498498
````
499499

500-
If we do not specify any params, declared will return an empty Hashie::Mash instance.
500+
If we do not specify any params, `declared` will return an empty `Hashie::Mash` instance.
501501

502502
**Request**
503503

@@ -550,15 +550,15 @@ curl -X POST -H "Content-Type: application/json" localhost:9292/users/signup -d
550550
}
551551
````
552552

553-
Returned hash is a Hashie::Mash instance so you can access parameters via dot notation:
553+
The returned hash is a `Hashie::Mash` instance, allowing you to access parameters via dot notation:
554554

555555
```ruby
556556
declared(params).user == declared(params)["user"]
557557
```
558558

559559
#### Include missing
560560

561-
By default `declared(params)` returns parameters that has `nil` value. If you want to return only the parameters that have any value, you can use the `include_missing` option. By default it is `true`. Let's have the following api:
561+
By default `declared(params)` includes parameters that have `nil` values. If you want to return only the parameters that are not `nil`, you can use the `include_missing` option. By default, `include_missing` is set to `true`. Consider the following API:
562562

563563
````ruby
564564
format :json

0 commit comments

Comments
 (0)