Improving and cleaning: classes should take care of initializing simple objects collection of instances without creating new objects for that exclusive taks.
This commit is contained in:
parent
d004a7ec55
commit
bd1257de86
@ -2,5 +2,9 @@ I model an asset of the Ironsworn Starforged Tabletop Roleplaying Game.
|
|||||||
|
|
||||||
More information at:
|
More information at:
|
||||||
|
|
||||||
[1] https://www.ironswornrpg.com/
|
[1] <https://www.ironswornrpg.com/>
|
||||||
[2] https://www.kickstarter.com/projects/shawntomkin/ironsworn-starforged
|
[2] <https://www.kickstarter.com/projects/shawntomkin/ironsworn-starforged>
|
||||||
|
|
||||||
|
I use as inspiration the data provided by @rsek at this repostory:
|
||||||
|
|
||||||
|
<https://github.com/rsek/datasworn>
|
@ -0,0 +1,6 @@
|
|||||||
|
accessing
|
||||||
|
collectionFromRepository: jsonFileUrl language: isoCode
|
||||||
|
| rawData |
|
||||||
|
rawData := STON fromString: jsonFileUrl asUrl retrieveContents.
|
||||||
|
^ (rawData at: 'Assets') collect: [:assetDict |
|
||||||
|
self new fromDictionary: assetDict; language: isoCode ]
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
collectionFromRepostory
|
||||||
|
^ self collectionFromRepository: 'https://raw.githubusercontent.com/rsek/dataforged/main/assets.json' language: 'en'
|
@ -1,6 +1,6 @@
|
|||||||
accessing
|
accessing
|
||||||
fromDictionary: aDictionary
|
fromDictionary: aDictionary
|
||||||
name := aDictionary at: #Name.
|
name := aDictionary at: #Name.
|
||||||
category := aDictionary at: #Category.
|
category := aDictionary at: 'Asset Type'.
|
||||||
abilities := self populateAbilities: (aDictionary at: #Abilities)
|
abilities := self populateAbilities: (aDictionary at: #Abilities)
|
||||||
|
|
@ -1,4 +0,0 @@
|
|||||||
I model a collection of Starforged assets.
|
|
||||||
I use as inspiration the data provided by @rsek at this repostory:
|
|
||||||
|
|
||||||
https://github.com/rsek/datasworn
|
|
@ -1,4 +0,0 @@
|
|||||||
instance creation
|
|
||||||
fromUrl: aString
|
|
||||||
"Convinience shortcut as most of resources are published originally in English."
|
|
||||||
^ self fromUrl: aString language: 'en'
|
|
@ -1,8 +0,0 @@
|
|||||||
accessing
|
|
||||||
fromUrl: aString language: isoCode
|
|
||||||
|
|
||||||
| rawData |
|
|
||||||
rawData := STON fromString: aString asUrl retrieveContents.
|
|
||||||
self items: ((rawData at: 'Assets') collect: [:assetDict |
|
|
||||||
SfAsset new fromDictionary: assetDict; language: isoCode ])
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
items: anObject
|
|
||||||
items := anObject
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
items
|
|
||||||
^ items ifNil: [ items := OrderedCollection ]
|
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"commentStamp" : "GlamorousAuthor 5/17/2021 16:41",
|
|
||||||
"super" : "Object",
|
|
||||||
"category" : "RoloLudo",
|
|
||||||
"classinstvars" : [ ],
|
|
||||||
"pools" : [ ],
|
|
||||||
"classvars" : [ ],
|
|
||||||
"instvars" : [
|
|
||||||
"items"
|
|
||||||
],
|
|
||||||
"name" : "SfAssets",
|
|
||||||
"type" : "normal"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user