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)
-
#otherize(default, **opts) ⇒ String
Select a phrase based on the entity’s subjective pronoun.
-
#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
59 60 61 |
# File 'lib/gamefic/grammar/attributes.rb', line 59 def objective Pronoun.objective self end |
#objective_ ⇒ Object Also known as: him_, them_, Him, Them
65 66 67 |
# File 'lib/gamefic/grammar/attributes.rb', line 65 def objective_ Pronoun.objective_ self end |
#otherize(default, **opts) ⇒ String
Select a phrase based on the entity’s subjective pronoun.
55 56 57 |
# File 'lib/gamefic/grammar/attributes.rb', line 55 def otherize default, **opts opts[subjective.to_sym] || default 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
90 91 92 |
# File 'lib/gamefic/grammar/attributes.rb', line 90 def possessive Pronoun.possessive self end |
#possessive_ ⇒ Object Also known as: his_, their_, its_, His, Their, Its
97 98 99 |
# File 'lib/gamefic/grammar/attributes.rb', line 97 def possessive_ Pronoun.possessive_ self end |
#reflexive ⇒ Object Also known as: himself, herself, itself, themselves, themself
107 108 109 |
# File 'lib/gamefic/grammar/attributes.rb', line 107 def reflexive Pronoun.reflexive self end |
#reflexive_ ⇒ Object Also known as: himself_, herself_, itself_, themselves_, themself_, Himself, Herself, Itself, Themselves, Themself
116 117 118 |
# File 'lib/gamefic/grammar/attributes.rb', line 116 def reflexive_ Pronoun.reflexive_ self end |
#subjective ⇒ Object Also known as: he, she, they
73 74 75 |
# File 'lib/gamefic/grammar/attributes.rb', line 73 def subjective Pronoun.subjective self end |
#subjective_ ⇒ Object Also known as: he_, she_, they_, He, She, They
80 81 82 |
# File 'lib/gamefic/grammar/attributes.rb', line 80 def subjective_ Pronoun.subjective_ self end |