Module: Gamefic::Grammar::Attributes
- Included in:
- Entity
- Defined in:
- lib/gamefic/grammar/attributes.rb
Overview
A collection of attributes that enable grammar features for entities, such as selecting their correct pronouns.
Instance Attribute Summary collapse
-
#gender ⇒ Symbol
The gender of the object.
- #plural ⇒ Object writeonly
Instance Method Summary collapse
- #maybe_plural(singular_text, plural_text = "#{singular_text}s") ⇒ String
- #objective ⇒ Object (also: #him, #them)
- #objective_ ⇒ Object (also: #him_, #them_, #Him, #Them)
-
#person ⇒ Object
For now, the object’s person is always assumed to be third (he/she/it/they).
-
#plural? ⇒ Boolean
True if the object should be referred to in the plural, e.g., “they” instead of “it.”.
- #possessive ⇒ Object (also: #his, #their, #its)
- #possessive_ ⇒ Object (also: #his_, #their_, #its_, #His, #Their, #Its)
- #reflexive ⇒ Object (also: #himself, #herself, #itself, #themselves, #themself)
- #reflexive_ ⇒ Object (also: #himself_, #herself_, #itself_, #themselves_, #themself_, #Himself, #Herself, #Itself, #Themselves, #Themself)
- #subjective ⇒ Object (also: #he, #she, #they)
- #subjective_ ⇒ Object (also: #he_, #she_, #they_, #He, #She, #They)
Instance Attribute Details
#gender ⇒ Symbol
The gender of the object. Supported values are :male, :female, :neutral, and :other. Use :neutral for objects that don’t have a gender (i.e., “it”). Use :other for people or characters that have an unspecified or non-binary gender (i.e., “they”).
21 22 23 |
# File 'lib/gamefic/grammar/attributes.rb', line 21 def gender @gender ||= :neutral end |
#plural=(value) ⇒ Object (writeonly)
13 14 15 |
# File 'lib/gamefic/grammar/attributes.rb', line 13 def plural=(value) @plural = value end |
Instance Method Details
#maybe_plural(singular_text, plural_text = "#{singular_text}s") ⇒ String
43 44 45 |
# File 'lib/gamefic/grammar/attributes.rb', line 43 def maybe_plural(singular_text, plural_text = "#{singular_text}s") plural? ? plural_text : singular_text end |
#objective ⇒ Object Also known as: him, them
47 48 49 |
# File 'lib/gamefic/grammar/attributes.rb', line 47 def objective Pronoun.objective self end |
#objective_ ⇒ Object Also known as: him_, them_, Him, Them
53 54 55 |
# File 'lib/gamefic/grammar/attributes.rb', line 53 def objective_ Pronoun.objective_ self end |
#person ⇒ Object
For now, the object’s person is always assumed to be third (he/she/it/they). A future version of this library might support first (I/me) and second (you).
36 37 38 |
# File 'lib/gamefic/grammar/attributes.rb', line 36 def person 3 end |
#plural? ⇒ Boolean
True if the object should be referred to in the plural, e.g., “they” instead of “it.”
29 30 31 |
# File 'lib/gamefic/grammar/attributes.rb', line 29 def plural? @plural ||= false end |
#possessive ⇒ Object Also known as: his, their, its
78 79 80 |
# File 'lib/gamefic/grammar/attributes.rb', line 78 def possessive Pronoun.possessive self end |
#possessive_ ⇒ Object Also known as: his_, their_, its_, His, Their, Its
85 86 87 |
# File 'lib/gamefic/grammar/attributes.rb', line 85 def possessive_ Pronoun.possessive_ self end |
#reflexive ⇒ Object Also known as: himself, herself, itself, themselves, themself
95 96 97 |
# File 'lib/gamefic/grammar/attributes.rb', line 95 def reflexive Pronoun.reflexive self end |
#reflexive_ ⇒ Object Also known as: himself_, herself_, itself_, themselves_, themself_, Himself, Herself, Itself, Themselves, Themself
104 105 106 |
# File 'lib/gamefic/grammar/attributes.rb', line 104 def reflexive_ Pronoun.reflexive_ self end |
#subjective ⇒ Object Also known as: he, she, they
61 62 63 |
# File 'lib/gamefic/grammar/attributes.rb', line 61 def subjective Pronoun.subjective self end |
#subjective_ ⇒ Object Also known as: he_, she_, they_, He, She, They
68 69 70 |
# File 'lib/gamefic/grammar/attributes.rb', line 68 def subjective_ Pronoun.subjective_ self end |