-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rb
58 lines (54 loc) · 978 Bytes
/
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require 'pry'
require_relative 'src/jrb'
def main
value = JRB.parse! '
{
"hello": "world",
"items": [
1,
6.9,
-1200000,
"Hello World!",
[
1,
2,
3
],
{
"hello": "John Doe",
"false": true,
"true": false,
"value": null
}
],
"foo": {
"data": {
"weirdnum": null
},
"asd": "ASD",
"items": []
}
}'
puts value
puts value.dig('foo', 'data', 'weirdnum')
h = {
SYMBOLS: {
COMMA: '⸲',
COLON: '→',
LEFTBRACKET: '{',
RIGHTBRACKET: '}',
LEFTBRACE: '[',
RIGHTBRACE: ']',
QUOTE: 'single'
},
WHITESPACE: [' ', "\n", "\t"],
BOOLEAN: {
TRUE: 'да',
FALSE: 'не'
},
NULL: 'fuck'
}
value = JRB.parse!(File.read('./tests/jrb/arrays_instead_of_objects.jrb'), config: h)
pp value
end
main