kdl 1.0.0.rc1 → 1.0.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/.github/workflows/ruby.yml +1 -1
- data/.gitignore +1 -0
- data/README.md +16 -2
- data/bin/kdl +8 -0
- data/kdl.gemspec +2 -1
- data/lib/kdl/kdl.tab.rb +208 -179
- data/lib/kdl/kdl.yy +30 -22
- data/lib/kdl/node.rb +20 -5
- data/lib/kdl/tokenizer.rb +6 -19
- data/lib/kdl/types/base64.rb +21 -0
- data/lib/kdl/types/country/iso3166_countries.rb +512 -0
- data/lib/kdl/types/country/iso3166_subdivisions.rb +3927 -0
- data/lib/kdl/types/country.rb +69 -0
- data/lib/kdl/types/currency/iso4217_currencies.rb +189 -0
- data/lib/kdl/types/currency.rb +26 -0
- data/lib/kdl/types/date_time.rb +41 -0
- data/lib/kdl/types/decimal.rb +13 -0
- data/lib/kdl/types/duration/iso8601_parser.rb +147 -0
- data/lib/kdl/types/duration.rb +28 -0
- data/lib/kdl/types/email/parser.rb +151 -0
- data/lib/kdl/types/email.rb +47 -0
- data/lib/kdl/types/hostname/validator.rb +51 -0
- data/lib/kdl/types/hostname.rb +36 -0
- data/lib/kdl/types/ip.rb +32 -0
- data/lib/kdl/types/irl/parser.rb +123 -0
- data/lib/kdl/types/irl.rb +46 -0
- data/lib/kdl/types/regex.rb +13 -0
- data/lib/kdl/types/url.rb +30 -0
- data/lib/kdl/types/url_template.rb +328 -0
- data/lib/kdl/types/uuid.rb +17 -0
- data/lib/kdl/types.rb +22 -0
- data/lib/kdl/value.rb +13 -2
- data/lib/kdl/version.rb +1 -1
- data/lib/kdl.rb +3 -2
- metadata +43 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7fd58e017395f4ce4c67e04d8c4324c27bfe816926a41ebf0a813231cbe3eaf
|
4
|
+
data.tar.gz: 5ad57dac159e4fabe083f209cf0d0bb07735ed533859da539b0c0796b2d3dc70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c84ac4702188843e47041424d50e35ed19dcacbc8c9ce334a4036e6a8f2201f6d3dc420c9fbd6a5262fd42e1e387090c4ffe1575b4a7d92081a5776844e5492
|
7
|
+
data.tar.gz: 4b02a0867a5ae9cc0e698df0308d91f9fa8b41a96e14ad5efd8b51e95659e3e20196a2d1c197e9dc6e0f96710f632e0d9295342e18e069b6313eac49a5841c72
|
data/.github/workflows/ruby.yml
CHANGED
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# KDL
|
2
2
|
|
3
|
-
[](https://github.com/danini-the-panini/kdl-rb/actions)
|
4
4
|
|
5
5
|
This is a Ruby implementation of the [KDL Document Language](https://kdl.dev)
|
6
6
|
|
@@ -28,6 +28,20 @@ require 'kdl'
|
|
28
28
|
KDL.parse_document(a_string) #=> KDL::Document
|
29
29
|
```
|
30
30
|
|
31
|
+
You can optionally provide your own type annotation handlers:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
KDL.parse_document(a_string, type_parsers: {
|
35
|
+
'foo' => -> (value, type) {
|
36
|
+
Foo.new(value.value, type: type)
|
37
|
+
}
|
38
|
+
})
|
39
|
+
```
|
40
|
+
|
41
|
+
The `foo` proc will be called with instances of Value or Node with the type annotation `(foo)`.
|
42
|
+
|
43
|
+
Parsers are expected to have a `call` method that takes the Value or Node, and the type annotation itself, as arguments, and is expected to return either an instance of Value or Node (depending on the input type) or `nil` to return the original value as is. Take a look at [the built in parsers](lib/kdl/types) as a reference.
|
44
|
+
|
31
45
|
## Development
|
32
46
|
|
33
47
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -36,7 +50,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
36
50
|
|
37
51
|
## Contributing
|
38
52
|
|
39
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
53
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/danini-the-panini/kdl-rb.
|
40
54
|
|
41
55
|
|
42
56
|
## License
|
data/bin/kdl
ADDED
data/kdl.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.description = %q{Ruby implementation of the KDL Document Language Spec}
|
11
11
|
spec.homepage = "https://kdl.dev"
|
12
12
|
spec.license = "MIT"
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
14
14
|
|
15
15
|
spec.metadata["homepage_uri"] = spec.homepage
|
16
16
|
spec.metadata["source_code_uri"] = "https://github.com/danini-the-panini/kdl-rb"
|
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
27
|
spec.add_development_dependency 'racc', '~> 1.5'
|
28
|
+
spec.add_dependency 'simpleidn', '~> 0.2.1'
|
28
29
|
end
|