t12n 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -20
- data/lib/t12n/interface.rb +12 -2
- data/lib/t12n/schema_builder.rb +2 -0
- data/lib/t12n/schema_store.rb +1 -1
- data/lib/t12n/version.rb +1 -1
- metadata +2 -3
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c352df68907d196975b7f76bdd6f6c457100926153034ed88ea295ae1b09081
|
4
|
+
data.tar.gz: 2ddc1c2ae840b0bb34db467f70c940d9c3b7a3c81d84bb4393d7e6c8628dd94f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 063dc527c987a30e6afe6bb427960b3253c4f52eceb7a4b1c75d008aaba6e0ffa61385a8275e4d4e69642538ac7b096e1adb04290646176681f5bd7fed913d18
|
7
|
+
data.tar.gz: 336f0a9a15dc36470b2d8cd1e9f492753b3453b0a8a140a66cc26e3ed85d2933a010e4a29b0892b50d444d298b9d132f5c98f64c82bed4ff06aef813c6d65440
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,35 +4,19 @@
|
|
4
4
|
|
5
5
|
Create schemas describing data transformations.
|
6
6
|
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 't12n'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle install
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install t12n
|
22
|
-
|
23
7
|
## Usage
|
24
8
|
|
25
|
-
See
|
9
|
+
See [spec/examples](spec/examples). The examples run as tests to ensure accuracy.
|
26
10
|
|
27
11
|
## Development
|
28
12
|
|
29
|
-
After checking out the repo, run `
|
13
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
14
|
|
31
15
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
16
|
|
33
17
|
## Contributing
|
34
18
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
19
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/austinthecoder/t12n. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/austinthecoder/t12n/blob/master/CODE_OF_CONDUCT.md).
|
36
20
|
|
37
21
|
## License
|
38
22
|
|
@@ -40,4 +24,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
40
24
|
|
41
25
|
## Code of Conduct
|
42
26
|
|
43
|
-
Everyone interacting in the T12n project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
27
|
+
Everyone interacting in the T12n project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/austinthecoder/t12n/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/t12n/interface.rb
CHANGED
@@ -3,9 +3,19 @@
|
|
3
3
|
module T12n
|
4
4
|
Interface = Ivo.new(:schema_store) do
|
5
5
|
def define_schema(name, &block)
|
6
|
+
raise ArgumentError, "No block given" unless block
|
7
|
+
|
8
|
+
raise ArgumentError, "Unexpected proc arity: #{block.arity}" if block.arity > 1
|
9
|
+
|
6
10
|
builder = SchemaBuilder.new(self)
|
7
|
-
|
8
|
-
|
11
|
+
|
12
|
+
if block.arity == 1
|
13
|
+
block.call(builder)
|
14
|
+
else
|
15
|
+
builder.instance_exec(&block)
|
16
|
+
end
|
17
|
+
|
18
|
+
schema = Schema.new(name, builder.schema_attrs, builder.context_blocks)
|
9
19
|
schema_store.save(schema)
|
10
20
|
:ok
|
11
21
|
end
|
data/lib/t12n/schema_builder.rb
CHANGED
data/lib/t12n/schema_store.rb
CHANGED
data/lib/t12n/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t12n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Schneider
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -56,7 +56,6 @@ files:
|
|
56
56
|
- README.md
|
57
57
|
- Rakefile
|
58
58
|
- bin/console
|
59
|
-
- bin/setup
|
60
59
|
- exe/t12n
|
61
60
|
- lib/t12n.rb
|
62
61
|
- lib/t12n/interface.rb
|