kdl 1.0.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +7 -1
- data/.gitignore +1 -0
- data/.gitmodules +4 -0
- data/Gemfile +6 -1
- data/README.md +51 -7
- data/Rakefile +6 -1
- data/bin/kdl +1 -1
- data/kdl.gemspec +2 -2
- data/lib/kdl/document.rb +58 -2
- data/lib/kdl/kdl.tab.rb +303 -228
- data/lib/kdl/kdl.yy +57 -49
- data/lib/kdl/node.rb +113 -12
- data/lib/kdl/parser_common.rb +26 -0
- data/lib/kdl/string_dumper.rb +30 -33
- data/lib/kdl/tokenizer.rb +350 -113
- data/lib/kdl/types/base64.rb +1 -1
- data/lib/kdl/types/country/iso3166_countries.rb +1 -1
- data/lib/kdl/types/country/iso3166_subdivisions.rb +1 -1
- data/lib/kdl/types/country.rb +2 -2
- data/lib/kdl/types/currency/iso4217_currencies.rb +1 -1
- data/lib/kdl/types/currency.rb +1 -1
- data/lib/kdl/types/date_time.rb +3 -3
- data/lib/kdl/types/decimal.rb +1 -1
- data/lib/kdl/types/duration/iso8601_parser.rb +1 -1
- data/lib/kdl/types/duration.rb +1 -1
- data/lib/kdl/types/email/parser.rb +1 -1
- data/lib/kdl/types/email.rb +1 -1
- data/lib/kdl/types/hostname/validator.rb +1 -1
- data/lib/kdl/types/hostname.rb +1 -1
- data/lib/kdl/types/ip.rb +1 -1
- data/lib/kdl/types/irl/parser.rb +1 -1
- data/lib/kdl/types/irl.rb +1 -1
- data/lib/kdl/types/regex.rb +1 -1
- data/lib/kdl/types/url.rb +1 -1
- data/lib/kdl/types/url_template.rb +1 -1
- data/lib/kdl/types/uuid.rb +1 -1
- data/lib/kdl/v1/document.rb +17 -0
- data/lib/kdl/v1/kdl.tab.rb +594 -0
- data/lib/kdl/v1/kdl.yy +89 -0
- data/lib/kdl/v1/node.rb +30 -0
- data/lib/kdl/v1/string_dumper.rb +28 -0
- data/lib/kdl/v1/tokenizer.rb +296 -0
- data/lib/kdl/v1/value.rb +89 -0
- data/lib/kdl/v1.rb +11 -0
- data/lib/kdl/value.rb +81 -12
- data/lib/kdl/version.rb +1 -1
- data/lib/kdl.rb +40 -1
- metadata +13 -4
data/lib/kdl/types/currency.rb
CHANGED
data/lib/kdl/types/date_time.rb
CHANGED
@@ -2,7 +2,7 @@ require 'time'
|
|
2
2
|
|
3
3
|
module KDL
|
4
4
|
module Types
|
5
|
-
class DateTime < Value
|
5
|
+
class DateTime < Value::Custom
|
6
6
|
def self.call(value, type = 'date-time')
|
7
7
|
return nil unless value.is_a? ::KDL::Value::String
|
8
8
|
|
@@ -12,7 +12,7 @@ module KDL
|
|
12
12
|
end
|
13
13
|
MAPPING['date-time'] = DateTime
|
14
14
|
|
15
|
-
class Time < Value
|
15
|
+
class Time < Value::Custom
|
16
16
|
# TODO: this is not a perfect ISO8601 time string
|
17
17
|
REGEX = /^T?((?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]+)?(?:Z|[+-]\d\d:\d\d)?)$/
|
18
18
|
|
@@ -28,7 +28,7 @@ module KDL
|
|
28
28
|
end
|
29
29
|
MAPPING['time'] = Time
|
30
30
|
|
31
|
-
class Date < Value
|
31
|
+
class Date < Value::Custom
|
32
32
|
def self.call(value, type = 'date')
|
33
33
|
return nil unless value.is_a? ::KDL::Value::String
|
34
34
|
|
data/lib/kdl/types/decimal.rb
CHANGED
@@ -25,7 +25,7 @@ require 'strscan'
|
|
25
25
|
|
26
26
|
module KDL
|
27
27
|
module Types
|
28
|
-
class Duration < Value
|
28
|
+
class Duration < Value::Custom
|
29
29
|
# Parses a string formatted according to ISO 8601 Duration into the hash.
|
30
30
|
#
|
31
31
|
# See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information.
|
data/lib/kdl/types/duration.rb
CHANGED
data/lib/kdl/types/email.rb
CHANGED
data/lib/kdl/types/hostname.rb
CHANGED
data/lib/kdl/types/ip.rb
CHANGED
data/lib/kdl/types/irl/parser.rb
CHANGED
data/lib/kdl/types/irl.rb
CHANGED
data/lib/kdl/types/regex.rb
CHANGED
data/lib/kdl/types/url.rb
CHANGED
data/lib/kdl/types/uuid.rb
CHANGED