-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make tutors work in Gemstone [feenkcom/gtoolkit#4322]
- Loading branch information
Showing
11 changed files
with
195 additions
and
18 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/GToolkit-GemStone-GemStone/AbstractDictionary.extension.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Extension { #name : 'AbstractDictionary' } | ||
|
||
{ #category : '*GToolkit-GemStone-GemStone' } | ||
AbstractDictionary >> isDictionary [ | ||
^ true | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Extension { #name : 'Collection' } | ||
|
||
{ #category : '*GToolkit-GemStone-GemStone' } | ||
Collection >> detect: aBlock ifFound: foundBlock ifNone: exceptionBlock [ | ||
self | ||
do: [ :each | | ||
(aBlock value: each) | ||
ifTrue: [ ^ foundBlock cull: each ] ]. | ||
^ exceptionBlock value | ||
] | ||
|
||
{ #category : '*GToolkit-GemStone-GemStone' } | ||
Collection >> isNotEmpty [ | ||
|
||
"Returns true if the receiver is not empty. Returns false otherwise." | ||
|
||
^self size ~~ 0 | ||
] | ||
|
||
{ #category : '*GToolkit-GemStone-GemStone' } | ||
Collection >> select: selectBlock thenCollect: collectBlock [ | ||
^ (self select: selectBlock) collect: collectBlock | ||
] | ||
|
||
{ #category : '*GToolkit-GemStone-GemStone' } | ||
Collection >> sorted: aBlock [ | ||
^ self sortWithBlock: aBlock | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Extension { #name : 'Duration' } | ||
|
||
{ #category : '*GToolkit-GemStone-GemStone' } | ||
Duration class >> nanoSeconds: nanoSeconds [ | ||
^ self seconds: nanoSeconds / 1000000 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/GToolkit-GemStone-GemStone/GtGemstoneHttpJsonSerializer.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Class { | ||
#name : 'GtGemstoneHttpJsonSerializer', | ||
#superclass : 'Object', | ||
#category : 'GToolkit-GemStone-GemStone' | ||
} | ||
|
||
{ #category : 'other' } | ||
GtGemstoneHttpJsonSerializer class >> serialize: anObject [ | ||
^ STONJSON toString: (self serializeObject: anObject) | ||
] | ||
|
||
{ #category : 'other' } | ||
GtGemstoneHttpJsonSerializer class >> serializeCollection: aCollection [ | ||
^ (aCollection collect: [:aValue | self serializeObject: aValue]) asArray | ||
] | ||
|
||
{ #category : 'other' } | ||
GtGemstoneHttpJsonSerializer class >> serializeDict: anObject [ | ||
^ anObject collect: [:aValue | self serializeObject: aValue] | ||
] | ||
|
||
{ #category : 'other' } | ||
GtGemstoneHttpJsonSerializer class >> serializeObject: anObject [ | ||
(anObject isKindOf: Dictionary) | ||
ifTrue: [ ^ self serializeDict: anObject ]. | ||
(anObject isKindOf: String) | ||
ifTrue: [ ^ anObject ]. | ||
(anObject isKindOf: Collection) | ||
ifTrue: [ ^ self serializeCollection: anObject ]. | ||
^ anObject | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Extension { #name : 'Number' } | ||
|
||
{ #category : '*GToolkit-GemStone-GemStone' } | ||
Number >> nanoSeconds [ | ||
^ Duration nanoSeconds: self | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Extension { #name : 'Pragma' } | ||
|
||
{ #category : '*GToolkit-GemStone-GemStone' } | ||
Pragma >> methodSelector [ | ||
"Answer the selector of the method containing the pragma." | ||
|
||
^ method selector. | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters