forked from ohler55/oj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes
93 lines (83 loc) · 2.61 KB
/
notes
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
;; -*- mode: outline; outline-regexp: " *[-\+]"; indent-tabs-mode: nil -*-
^c^d hide subtree
^c^s show subtree
- next
- implement Oj::Doc.new or open without a block given
- requires a close
- write JSON compatible extension
- attributes - ignore for now
- methods
- create_id - default json_class
- get/set create_id
- generator and parser
- just return JSON itself or fake JSON::Ext::xxxx
- state
- return config info as object with same methods as JSON
- JSON::Ext::Generator::State or JSON::Pure::Generator::State
- JSON.[](object, opts={})
- if String then parse else dump
- restore(source, proc=nil) - alias for load
- load(source, proc=nil)
- takes String, IO, or respond_to?(:read)
- dump(obj, io=nil, limit=nil)
- fast_generate(obj, opts=nil)
- generate(obj, opts=nil)
- opts
- indent
- space - after :
- space_before - ignored by json
- object_nl - after each key/value pair
- array_nl
- allow_nan
- max_nesting
- parse(source, opts={})
- opts
- max_nesting - 19
- allow_nan - false
- symbolize_names - false
- create_additions - true (uses create_id to create classes)
- object_class - Hash
- array_class - Array
- parse!(source, opts={})
- opts
- max_nesting - nil
- allow_nan - true
- create_additions - true
- pretty_generate(obj, opts=nil)
- opts same as generate, must have different defaults
- recurse_proc(result, &proc)
- verify
- what happens with circular references
- how does recurse_proc work
- how does proc with load/restore work
- can Oj be assigned to JSON if JSON does not exist?
- stream
- use with Oj::Doc
- use with standard
- add callback SAX like option
- callback parser
- object_start
- object_end
- array_start
- array_end
- value
- key
- default callbacks use straight C and create Hash or Object according to mode
- callback object
- check respond_to? for each method at start
- methods to indicate that defaults should be used instead of ignored
- use_default_hash_callback?
- use_default_array_callback?
- use_default_key_callback?
- use_default_value_callback?
- or maybe
- hash_callback? returns nil, :default, :my_hash_callback
- default is to check hash_start and hash_end and no nothing if they do not exist
-
- dump
- support stream as arg
- always dump to stream/file if possible (check performance)
- example
- contacts
- pull apart input file with multiple contacts and write individual files
- phone book get only name and phone