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

Instance Method Summary collapse

Instance Attribute Details

#genderSymbol

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”).

Returns:

  • (Symbol)


21
22
23
# File 'lib/gamefic/grammar/attributes.rb', line 21

def gender
  @gender ||= :neutral
end

#plural=(value) ⇒ Object (writeonly)

See Also:



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

Parameters:

  • singular_text (String)
  • plural_text (String) (defaults to: "#{singular_text}s")

Returns:

  • (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

#objectiveObject 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

#personObject

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.”

Returns:

  • (Boolean)


29
30
31
# File 'lib/gamefic/grammar/attributes.rb', line 29

def plural?
  @plural ||= false
end

#possessiveObject 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

#reflexiveObject 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

#subjectiveObject 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