From d70b6df718339c2aef88ac70f8c5577f755ba667 Mon Sep 17 00:00:00 2001 From: Sven Van Caekenberghe Date: Tue, 24 Oct 2023 11:33:58 +0200 Subject: [PATCH] Extend docs --- lepiter/81brlbrknhsro4cxzdl06l22t.bak | 87 ++++++++++++++++-- lepiter/81brlbrknhsro4cxzdl06l22t.lepiter | 89 +++++++++++++++++-- .../Neo-JSON-Core/NeoJSONObject.class.st | 12 +++ 3 files changed, 177 insertions(+), 11 deletions(-) diff --git a/lepiter/81brlbrknhsro4cxzdl06l22t.bak b/lepiter/81brlbrknhsro4cxzdl06l22t.bak index 96278d9..eef434e 100644 --- a/lepiter/81brlbrknhsro4cxzdl06l22t.bak +++ b/lepiter/81brlbrknhsro4cxzdl06l22t.bak @@ -217,7 +217,7 @@ "__type" : "time", "time" : { "__type" : "dateAndTime", - "dateAndTimeString" : "2023-10-23T15:01:16.025958+02:00" + "dateAndTimeString" : "2023-10-24T11:06:23.066158+02:00" } }, "uid" : { @@ -269,6 +269,83 @@ "previewExpanded" : false, "noCode" : false }, + { + "__type" : "textSnippet", + "children" : { + "__type" : "snippets", + "items" : [ ] + }, + "createEmail" : { + "__type" : "email", + "emailString" : "" + }, + "createTime" : { + "__type" : "time", + "time" : { + "__type" : "dateAndTime", + "dateAndTimeString" : "2023-10-24T10:52:41.800972+02:00" + } + }, + "editEmail" : { + "__type" : "email", + "emailString" : "" + }, + "editTime" : { + "__type" : "time", + "time" : { + "__type" : "dateAndTime", + "dateAndTimeString" : "2023-10-24T11:08:17.241982+02:00" + } + }, + "uid" : { + "__type" : "uid", + "uidString" : "dVXPMtTEDQC1y38DBchSng==" + }, + "paragraphStyle" : { + "__type" : "textStyle" + }, + "string" : "{{gtClass:NeoJSONObject}} is a subclass of OrderedDictionary which automatically implements accessors using key access. When a key does not exist, nil is returned instead of a {{gtClass:KeyNotFound}} being raised." + }, + { + "__type" : "exampleSnippet", + "children" : { + "__type" : "snippets", + "items" : [ ] + }, + "createEmail" : { + "__type" : "email", + "emailString" : "" + }, + "createTime" : { + "__type" : "time", + "time" : { + "__type" : "dateAndTime", + "dateAndTimeString" : "2023-10-24T11:16:16.219788+02:00" + } + }, + "editEmail" : { + "__type" : "email", + "emailString" : "" + }, + "editTime" : { + "__type" : "time", + "time" : { + "__type" : "dateAndTime", + "dateAndTimeString" : "2023-10-24T11:16:16.219788+02:00" + } + }, + "uid" : { + "__type" : "uid", + "uidString" : "Vq4dh9TEDQC8hjUdBchSng==" + }, + "exampleSelector" : "exampleSimpleUsage", + "previewHeight" : 200, + "previewShowSelector" : "gtViewsFor:", + "exampleBehaviorName" : "NeoJSONObject class", + "codeExpanded" : true, + "previewExpanded" : false, + "noCode" : false + }, { "__type" : "textSnippet", "children" : { @@ -294,7 +371,7 @@ "__type" : "time", "time" : { "__type" : "dateAndTime", - "dateAndTimeString" : "2023-10-23T14:58:50.307554+02:00" + "dateAndTimeString" : "2023-10-24T11:21:09.587872+02:00" } }, "uid" : { @@ -304,7 +381,7 @@ "paragraphStyle" : { "__type" : "textStyle" }, - "string" : "Let's see. One convenient way to parse this is to use NeoJSONObject class>>#fromString." + "string" : "One convenient way to parse JSON is to use {{gtMethod: NeoJSONObject class>>#fromString:}}." }, { "__type" : "exampleSnippet", @@ -371,7 +448,7 @@ "__type" : "time", "time" : { "__type" : "dateAndTime", - "dateAndTimeString" : "2023-10-23T14:59:48.738683+02:00" + "dateAndTimeString" : "2023-10-24T10:52:03.553046+02:00" } }, "uid" : { @@ -381,7 +458,7 @@ "paragraphStyle" : { "__type" : "textStyle" }, - "string" : "The inverse operation, from an object to JSON is also convenient, given it is a NeoJSONObject." + "string" : "The inverse operation, from an object to JSON is also convenient, given it is a {{gtClass:NeoJSONObject}} whose {{gtMethod: NeoJSONObject>>#printOn:}} outputs JSON." }, { "__type" : "exampleSnippet", diff --git a/lepiter/81brlbrknhsro4cxzdl06l22t.lepiter b/lepiter/81brlbrknhsro4cxzdl06l22t.lepiter index 6cba269..3d76944 100644 --- a/lepiter/81brlbrknhsro4cxzdl06l22t.lepiter +++ b/lepiter/81brlbrknhsro4cxzdl06l22t.lepiter @@ -186,7 +186,7 @@ }, "exampleSelector" : "exampleSimpleJSON", "previewHeight" : 200, - "previewShowSelector" : "gtViewsFor:", + "previewShowSelector" : "gtStringFor:", "exampleBehaviorName" : "NeoJSONObject class", "codeExpanded" : true, "previewExpanded" : false, @@ -217,7 +217,7 @@ "__type" : "time", "time" : { "__type" : "dateAndTime", - "dateAndTimeString" : "2023-10-23T15:01:16.025958+02:00" + "dateAndTimeString" : "2023-10-24T11:06:23.066158+02:00" } }, "uid" : { @@ -269,6 +269,83 @@ "previewExpanded" : false, "noCode" : false }, + { + "__type" : "textSnippet", + "children" : { + "__type" : "snippets", + "items" : [ ] + }, + "createEmail" : { + "__type" : "email", + "emailString" : "" + }, + "createTime" : { + "__type" : "time", + "time" : { + "__type" : "dateAndTime", + "dateAndTimeString" : "2023-10-24T10:52:41.800972+02:00" + } + }, + "editEmail" : { + "__type" : "email", + "emailString" : "" + }, + "editTime" : { + "__type" : "time", + "time" : { + "__type" : "dateAndTime", + "dateAndTimeString" : "2023-10-24T11:08:17.241982+02:00" + } + }, + "uid" : { + "__type" : "uid", + "uidString" : "dVXPMtTEDQC1y38DBchSng==" + }, + "paragraphStyle" : { + "__type" : "textStyle" + }, + "string" : "{{gtClass:NeoJSONObject}} is a subclass of OrderedDictionary which automatically implements accessors using key access. When a key does not exist, nil is returned instead of a {{gtClass:KeyNotFound}} being raised." + }, + { + "__type" : "exampleSnippet", + "children" : { + "__type" : "snippets", + "items" : [ ] + }, + "createEmail" : { + "__type" : "email", + "emailString" : "" + }, + "createTime" : { + "__type" : "time", + "time" : { + "__type" : "dateAndTime", + "dateAndTimeString" : "2023-10-24T11:16:16.219788+02:00" + } + }, + "editEmail" : { + "__type" : "email", + "emailString" : "" + }, + "editTime" : { + "__type" : "time", + "time" : { + "__type" : "dateAndTime", + "dateAndTimeString" : "2023-10-24T11:16:16.219788+02:00" + } + }, + "uid" : { + "__type" : "uid", + "uidString" : "Vq4dh9TEDQC8hjUdBchSng==" + }, + "exampleSelector" : "exampleSimpleUsage", + "previewHeight" : 200, + "previewShowSelector" : "gtViewsFor:", + "exampleBehaviorName" : "NeoJSONObject class", + "codeExpanded" : true, + "previewExpanded" : false, + "noCode" : false + }, { "__type" : "textSnippet", "children" : { @@ -294,7 +371,7 @@ "__type" : "time", "time" : { "__type" : "dateAndTime", - "dateAndTimeString" : "2023-10-23T15:01:32.987758+02:00" + "dateAndTimeString" : "2023-10-24T11:21:09.587872+02:00" } }, "uid" : { @@ -304,7 +381,7 @@ "paragraphStyle" : { "__type" : "textStyle" }, - "string" : "Let's see. One convenient way to parse JSON is to use NeoJSONObject class>>#fromString." + "string" : "One convenient way to parse JSON is to use {{gtMethod: NeoJSONObject class>>#fromString:}}." }, { "__type" : "exampleSnippet", @@ -371,7 +448,7 @@ "__type" : "time", "time" : { "__type" : "dateAndTime", - "dateAndTimeString" : "2023-10-23T14:59:48.738683+02:00" + "dateAndTimeString" : "2023-10-24T10:52:03.553046+02:00" } }, "uid" : { @@ -381,7 +458,7 @@ "paragraphStyle" : { "__type" : "textStyle" }, - "string" : "The inverse operation, from an object to JSON is also convenient, given it is a NeoJSONObject." + "string" : "The inverse operation, from an object to JSON is also convenient, given it is a {{gtClass:NeoJSONObject}} whose {{gtMethod: NeoJSONObject>>#printOn:}} outputs JSON." }, { "__type" : "exampleSnippet", diff --git a/repository/Neo-JSON-Core/NeoJSONObject.class.st b/repository/Neo-JSON-Core/NeoJSONObject.class.st index 737b275..d5da387 100644 --- a/repository/Neo-JSON-Core/NeoJSONObject.class.st +++ b/repository/Neo-JSON-Core/NeoJSONObject.class.st @@ -103,6 +103,18 @@ NeoJSONObject class >> exampleSimpleParsing [ ^ result ] +{ #category : #example } +NeoJSONObject class >> exampleSimpleUsage [ + + | simple | + simple := NeoJSONObject exampleSimple. + self assert: simple foo equals: (simple at: #foo). + self assert: (simple foo: -1) equals: (simple at: #foo put: -1; yourself). + self assert: (simple includesKey: #baz) not. + self assert: simple baz equals: nil. + ^ simple +] + { #category : #example } NeoJSONObject class >> exampleSimpleWriting [