(Quick Reference)
Purpose
Create or
Update a
Smartionary and/or its
SmartionaryEntry associations.
Examples
Set Only Smartionary
Smartionary.set("fruits")
Smartionary.set("fruits", "A few fruits, by letter.")
Set Using Map
Map toSmartionary = [
a: "apple",
b: "banana",
c: "cantaloupe",
d: "durian",
smartionaryDescriptions: [
a: "Can be green, yellow, or red; sour or sweet.",
b: 'Grows in bunches, called "hands."',
c: "A kind of melon with a lattuce skin.",
d: "A spiney fruit like a pineapple, that's really stinky.",
]
]Smartionary.set(toSmartionary, "fruits", "A few fruits, by letter.")
Smartionary.set(
'fruits',
'A few fruits, by letter.',
a: "apple",
b: "banana",
c: "cantaloupe",
d: "durian",
smartionaryDescriptions: [
a: "Can be green, yellow, or red; sour or sweet.",
b: 'Grows in bunches, called "hands."',
c: "A kind of melon with a lattuce skin.",
d: "A spiney fruit like a pineapple, that's really stinky.",
]
)
Set Explicitly
Smartionary.set("fruits", "t", "tomato")
Smartionary.set("fruits", "t", "tomato", "A red, fragile bulb; debated to be a vegetable.")
Smartionary.set("fruits", "t", "tomato", "A red, fragile bulb; debated to be a vegetable.", "Letters associated to Fruits for teaching aide.")
Description
When setting with a
Map
the
smartionaryDescriptions
is a special key that
tells the method to associate those descriptions with the matching key in the
outer layer (non-matching keys are ignored).
smartionaryDescription
and
entryDescription
are optional parameters.
Be mindful of use-cases where it may only be necessary
to only update descriptions.