class Discryb::ComplimentTemplate
- Discryb::ComplimentTemplate
- Reference
- Object
Overview
A ComplimentTemplate
contains templates that are used to form compliment
strings.
The top-level compliments are in #base_templates
, and they are instantiated
using the subtemplates and strings in #subtemplates
.
Defined in:
discryb/compliment_template.crConstructors
-
.new(base_templates : Array(String), subtemplates : Hash(String, Array(String)), seed = nil)
Creates a new ComplimentTemplate with the given base templates and subtemplates
Class Method Summary
-
.from_yaml(string_or_io : String | IO)
Creates a new ComplimentTemplate from the given YAML string or IO
Instance Method Summary
-
#all_instantiations
Outputs all possible instantiations of all base templates
- #base_templates : Array(String)
-
#generate_compliment
Randomly generates a compliment from the base templates
-
#instantiate_template(template : String)
Randomly turns a compliment template into a concrete string through repeated substitution
- #subtemplates : Hash(String, Array(String))
-
#valid?
Returns true if all templates will instantiate into concrete strings, otherwise returns false
Constructor Detail
Creates a new ComplimentTemplate with the given base templates and subtemplates
Class Method Detail
Creates a new ComplimentTemplate from the given YAML string or IO
Instance Method Detail
Randomly turns a compliment template into a concrete string through repeated substitution
Returns true if all templates will instantiate into concrete strings, otherwise returns false