Skip to content

Commit ccacb6f

Browse files
authored
Fix grammar and punctuation in README.md
1 parent 3e2bd4d commit ccacb6f

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@
1818
<a href="https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=428442325" title="Open in GitHub Codespaces" ><img alt="Open in GitHub Codespaces" src="https://github.com/codespaces/badge.svg"></a>
1919
</p>
2020

21-
A ruby library for the human friendly data format [NestedText](https://nestedtext.org/).
21+
A Ruby library for the human-friendly data format [NestedText](https://nestedtext.org/).
2222

23-
<!-- Use URL to hosted image, so that it shows up at rubydocs.info as well. Using relative image and yardoc option "--asset img:img" did not work. -->
23+
<!-- Use URL to host image, so that it shows up at rubydocs.info as well. Using the relative image and yardoc option "--asset img:img" did not work. -->
2424
<a href="#" ><img src="https://raw.githubusercontent.com/erikw/nestedtext-ruby/main/img/logo.webp" align="right" width="420px" alt="nestedtext-ruby logo" /></a>
2525

26-
Provided is support for decoding a NestedText file or string to Ruby data structures, as well as encoding Ruby objects to a NestedText file or string. Furthermore there is support for serialization and deserialization of custom classes. The supported language version of the data format can be seen in the badge above. This implementation pass all the [official tests](https://github.com/KenKundert/nestedtext_tests).
26+
Provided is support for decoding a NestedText file or string to Ruby data structures, as well as encoding Ruby objects to a NestedText file or string. Furthermore, there is support for serialization and deserialization of custom classes. The supported language version of the data format can be seen in the badge above. This implementation passes all the [official tests](https://github.com/KenKundert/nestedtext_tests).
2727

28-
This library is inspired by Ruby's stdlib modules `JSON` and `YAML` as well as the Python [reference implementation](https://github.com/KenKundert/nestedtext) of NestedText. Parsing is done with a LL(1) recursive descent parser and dumping with a recursive DFS traversal of the object references.
28+
This library is inspired by Ruby's stdlib modules `JSON` and `YAML` as well as the Python [reference implementation](https://github.com/KenKundert/nestedtext) of NestedText. Parsing is done with an LL(1) recursive descent parser, and dumping is with a recursive DFS traversal of the object references.
2929

3030
> [!TIP]
3131
> To make this library practically useful, you should pair it with a [schema validator](#schema).
3232
3333
# What is NestedText?
3434
Citing from the official [introduction](https://nestedtext.org/en/latest/index.html) page:
35-
> NestedText is a file format for holding structured data to be entered, edited, or viewed by people. It organizes the data into a nested collection of dictionaries, lists, and strings without the need for quoting or escaping. A unique feature of this file format is that it only supports one scalar type: strings. While the decision to eschew integer, real, date, etc. types may seem counter intuitive, it leads to simpler data files and applications that are more robust.
35+
> NestedText is a file format for holding structured data to be entered, edited, or viewed by people. It organizes the data into a nested collection of dictionaries, lists, and strings without the need for quoting or escaping. A unique feature of this file format is that it only supports one scalar type: strings. While the decision to eschew integer, real, date, etc. types may seem counterintuitive, it leads to simpler data files and applications that are more robust.
3636
>
3737
> NestedText is convenient for configuration files, address books, account information, and the like. Because there is no need for quoting or escaping, it is particularly nice for holding code fragments.
3838
39-
*"Why do we need another data format?"* is the right question to ask. The answer is that the current popular formats (JSON, YAML, TOML, INI etc.) all have shortcomings which NestedText [addresses](https://nestedtext.org/en/latest/alternatives.html).
39+
*"Why do we need another data format?"* is the right question to ask. The answer is that the current popular formats (JSON, YAML, TOML, INI, etc.) all have shortcomings which NestedText [addresses](https://nestedtext.org/en/latest/alternatives.html).
4040

4141
## Example
4242
Here's a full-fledged example of an address book (from the official docs):
@@ -79,16 +79,16 @@ obj1 = NestedText::load(ntstr)
7979
obj2 = NestedText::load_file("path/to/data.nt")
8080
```
8181

82-
The type of the returned object depends on the top level type in the NestedText data and will be of corresponding native Ruby type. In the example above, `obj1` will be an `Array` and `obj2` will be `Hash` if `data.nt` looks like e.g.
82+
The type of the returned object depends on the top-level type in the NestedText data and will be of the corresponding native Ruby type. In the example above, `obj1` will be an `Array` and `obj2` will be a `Hash` if `data.nt` looks like e.g.
8383

8484
```
8585
key1: value1
8686
key2: value2
8787
```
8888

89-
Thus you must know what you're parsing, or test what you decoded after.
89+
Thus, you must know what you're parsing, or test what you decoded after.
9090

91-
### Explicit Top Level Type
91+
### Explicit Top-Level Type
9292
If you already know what you expect to have, you can guarantee that this is what you will get by telling either function what the expected top type is. If not, an error will be raised.
9393

9494
```ruby
@@ -99,7 +99,7 @@ array = NestedText::load(ntstr, top_class: Array)
9999

100100
hash = NestedText::load_file("path/to/data.nt", top_class: Hash)
101101

102-
# will raise NestedText::Error as we specify top level String but it will be Array.
102+
# will raise NestedText::Error as we specify top-level String, but it will be an Array.
103103
NestedText::load(ntstr, top_class: String)
104104
```
105105

@@ -142,7 +142,7 @@ k3:
142142
```
143143

144144
## Types
145-
Ruby classes maps like this to NestedText types:
145+
Ruby classes map like this to NestedText types:
146146
Ruby | [NestedText](https://nestedtext.org/en/latest/basic_syntax.html)
147147
---|---
148148
`String` |`String`
@@ -151,7 +151,7 @@ Ruby | [NestedText](https://nestedtext.org/en/latest/basic_syntax.html)
151151

152152

153153
### Strict Mode
154-
The strict mode determines how classes other than the basic types `String`, `Array` and `Hash` are handled during encoding and decoding. By **default** strict mode is **false**.
154+
The strict mode determines how classes other than the basic types `String`, `Array`, and `Hash` are handled during encoding and decoding. By **default** strict mode is **false**.
155155

156156
With `strict: true`
157157
Ruby | NestedText | Comment
@@ -194,10 +194,10 @@ class Apple
194194
end
195195
```
196196

197-
When an apple instance will be serialized e.g. by `apple.to_nt`, NestedText will call `Apple.encode_nt_with` if it exist and let the returned data be encoded to represent the instance.
197+
When an Apple instance will be serialized, e.g., by `apple.to_nt`, NestedText will call `Apple.encode_nt_with` if it exists and let the returned data be encoded to represent the instance.
198198

199199

200-
To be able to get this instance back when deserializing the NestedText there must be a class method `Class.nt_create(data)`. When deserializing NestedText and the class `Apple` is detected, and the method `#nt_create` exist on the class, it will be called with the decoded data belonging to it. This method should create and return a new instance of the class. In the most simple case it's just translating this to a call to `#new`.
200+
To be able to get this instance back when deserializing the NestedText, there must be a class method `Class.nt_create(data)`. When deserializing NestedText and the class `Apple` is detected, and the method `#nt_create` exists on the class, it will be called with the decoded data belonging to it. This method should create and return a new instance of the class. In the simplest case, it's just translating this to a call to `#new`.
201201

202202
In full, the `Apple` class should look like:
203203

@@ -228,7 +228,7 @@ data:
228228
- 12
229229
```
230230

231-
If you want to add some more super powers to your custom class, you can add the `#to_nt` shortcut by including the `ToNTMixin`:
231+
If you want to add some more superpowers to your custom class, you can add the `#to_nt` shortcut by including the `ToNTMixin`:
232232
```ruby
233233
class Apple
234234
include NestedText::ToNTMixin
@@ -240,9 +240,9 @@ Apple.new("granny smith", 12).to_nt
240240

241241

242242
**Important notes**:
243-
* The special key to denote the class name is subject to change in future versions and you **must not** rely on it.
243+
* The special key to denote the class name is subject to change in future versions, and you **must not** rely on it.
244244
* Custom Classes **can not be a key** in a Hash. Trying to do this will raise an Error.
245-
* When deserializing a custom class, this custom class must be available when calling the `#dump*` methods e.g.
245+
* When deserializing a custom class, this custom class must be available when calling the `#dump*` method,s e.g.
246246
```ruby
247247
require 'nestedtext'
248248
require_relative 'apple' # This is needed if Apple is defined in apple.rb and not in this scope already.
@@ -254,13 +254,13 @@ Apple.new("granny smith", 12).to_nt
254254
> See [encode_custom_classes_test.rb](test/nestedtext/encode_custom_classes_test.rb) for more real working examples.
255255
256256
# Schema
257-
The point of NestedText is to not get in to business of supporting ambiguous types. That's why all values are simple strings. Having only simple strings is not useful in practice though. This is why NestedText is intended to be paired with a [Schema Validator](https://nestedtext.org/en/latest/schemas.html)!
257+
The point of NestedText is not to get into to business of supporting ambiguous types. That's why all values are simple strings. Having only simple strings is not useful in practice, though. This is why NestedText is intended to be paired with a [Schema Validator](https://nestedtext.org/en/latest/schemas.html)!
258258

259259
A schema validator can:
260260
* assert that the parsed values are of the expected types
261261
* automatically convert them to Ruby class instances like Integer, Float, etc.
262262

263-
The reference implementation in Python [lists](https://nestedtext.org/en/latest/examples.html) a few examples of Python validators. Here below is an example of how this Ruby implementation of NestedText can be paired it with [RSchema](https://github.com/tomdalling/rschema).
263+
The reference implementation in Python [lists](https://nestedtext.org/en/latest/examples.html) provides a few examples of Python validators. Below is an example of how this Ruby implementation of NestedText can be paired with [RSchema](https://github.com/tomdalling/rschema).
264264

265265
## Example with RSchema
266266
The full and working example can be found at [erikw/nestedtext-ruby-test](https://github.com/erikw/nestedtext-ruby-test/blob/main/parse_validate.rb).
@@ -279,7 +279,7 @@ Let's say that you have a program that should connect to a few servers. The list
279279
stable: false
280280
```
281281
282-
After parsing this file with this NestedText library, the values for all keys will be string. But to make practical use of this, we would of course like the values for the `port` keys to be `Integer`, and `stable` should have a value of either `true` or `false`. RSchema can do this conversion for us!
282+
After parsing this file with the NestedText library, the values for all keys will be strings. But to make practical use of this, we would of course like the values for the `port` keys to be `Integer`, and `stable` should have a value of either `true` or `false`. RSchema can do this conversion for us!
283283

284284

285285
```ruby
@@ -295,7 +295,7 @@ schema = RSchema.define do
295295
)
296296
end
297297
298-
# The coercer will automatially convert types
298+
# The coercer will automatically convert types
299299
coercer = RSchema::CoercionWrapper::RACK_PARAMS.wrap(schema)
300300
301301
# Parse config file with NestedText
@@ -315,7 +315,7 @@ port_sum = servers.map { |server| server['port'] }.sum
315315
```
316316

317317
# Installation
318-
1. Add this gem to your ruby project's Gemfile
318+
1. Add this gem to your Ruby project's Gemfile
319319
- Simply with `$ bundle add nestedtext` when standing inside your project
320320
- Or manually by adding to `Gemfile`
321321
```ruby
@@ -338,13 +338,13 @@ port_sum = servers.map { |server| server['port'] }.sum
338338
```shell
339339
git clone https://github.com/erikw/nestedtext-ruby.git && cd $(basename "$_" .git)
340340
```
341-
1. Install a supported ruby version (see .gemspec) with a ruby version manager e.g. [rbenv](https://github.com/rbenv/rbenv), [asdf](http://asdf-vm.com/) or [RVM](https://rvm.io/rvm/install)
341+
1. Install a supported Ruby version (see .gemspec) with a Ruby version manager e.g., [rbenv](https://github.com/rbenv/rbenv), [asdf](http://asdf-vm.com/) or [RVM](https://rvm.io/rvm/install)
342342
1. run `$ scripts/setup` or `$ bundle install` to install dependencies
343343
1. run `$ scripts/test` or `bundle exec rake test` to run the tests
344344
1. You can also run `$ scripts/console` for an interactive prompt that will allow you to experiment.
345-
1. For local testing, install the gem on local machine with: `$ bundle exec rake install`.
345+
1. For local testing, install the gem on the local machine with: `$ bundle exec rake install`.
346346
* or manually with `$ gem build *.gemscpec && gem install *.gem`
347-
1. Watch changes on file system and execute tests with `$ bundle exec guard`.
347+
1. Watch changes on the file system and execute tests with `$ bundle exec guard`.
348348

349349

350350
Extra:
@@ -357,7 +357,7 @@ Extra:
357357
* To see undocumented methods with [YARD](https://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md): `$ yard stats --list-undoc`
358358
359359
# Releasing
360-
Instructions for releasing on rubygems.org below. Optionally make a GitHub [release](https://github.com/erikw/nestedtext-ruby/releases) after this for the pushed git tag.
360+
Instructions for releasing on rubygems.org are below. Optionally make a GitHub [release](https://github.com/erikw/nestedtext-ruby/releases) after this for the pushed git tag.
361361
362362
## (manually) Using bundler/gem_tasks rake tasks
363363
Following instructions from [bundler.io](https://bundler.io/guides/creating_gem.html#releasing-the-gem):
@@ -410,5 +410,5 @@ Bug reports and pull requests are welcome on GitHub at [erikw/nestedtext-ruby](h
410410
The gem is available as open source with the [License](./LICENSE.txt).
411411

412412
# Acknowledgments
413-
* Thanks to the data format authors making it easier making new implementations by providing an [official test suite](https://github.com/KenKundert/nestedtext_tests).
413+
* Thanks to the data format authors for making it easier to make new implementations by providing an [official test suite](https://github.com/KenKundert/nestedtext_tests).
414414
* Thanks to [pixteller](https://pixteller.com/) & [mp4.to](https://mp4.to/webp/) for offering the tools needed for creating an animated logo.

0 commit comments

Comments
 (0)