Module: Grammar::Pronoun

Defined in:
lib/gamefic-standard/grammar/pronoun.rb

Overview

Functions to select pronouns based on an entity’s attributes, such as gender.

Class Method Summary collapse

Class Method Details

.map(entity) ⇒ Hash

Parameters:

  • entity (#person, #plural?, #gender)

Returns:

  • (Hash)


73
74
75
76
77
# File 'lib/gamefic-standard/grammar/pronoun.rb', line 73

def map(entity)
  plurality = (entity.plural? ? :plural : :singular)
  maps[[(entity.person || 3), plurality, entity.gender]] ||
    maps[[(entity.person || 3), plurality]]
end

.objective(entity) ⇒ String Also known as: them

Parameters:

  • entity (#person, #plural?, #gender)

Returns:

  • (String)


29
30
31
# File 'lib/gamefic-standard/grammar/pronoun.rb', line 29

def objective(entity)
  map(entity)[:objective]
end

.objective_(entity) ⇒ String Also known as: them_

Parameters:

  • entity (#person, #plural?, #gender)

Returns:

  • (String)


36
37
38
# File 'lib/gamefic-standard/grammar/pronoun.rb', line 36

def objective_(entity)
  objective(entity).cap_first
end

.possessive(entity) ⇒ String Also known as: their

Parameters:

  • entity (#person, #plural?, #gender)

Returns:

  • (String)


43
44
45
# File 'lib/gamefic-standard/grammar/pronoun.rb', line 43

def possessive(entity)
  map(entity)[:possessive]
end

.possessive_(entity) ⇒ String Also known as: their_

Parameters:

  • entity (#person, #plural?, #gender)

Returns:

  • (String)


50
51
52
# File 'lib/gamefic-standard/grammar/pronoun.rb', line 50

def possessive_(entity)
  possessive(entity).cap_first
end

.reflexive(entity) ⇒ String Also known as: themselves, themself

Parameters:

  • entity (#person, #plural?, #gender)

Returns:

  • (String)


57
58
59
# File 'lib/gamefic-standard/grammar/pronoun.rb', line 57

def reflexive(entity)
  map(entity)[:reflexive]
end

.reflexive_(entity) ⇒ String Also known as: themselves_, themself_

Parameters:

  • entity (#person, #plural?, #gender)

Returns:

  • (String)


65
66
67
# File 'lib/gamefic-standard/grammar/pronoun.rb', line 65

def reflexive_(entity)
  reflexive(entity).cap_first
end

.subjective(entity) ⇒ String Also known as: they, he, she

Parameters:

  • entity (#person, #plural?, #gender)

Returns:

  • (String)


11
12
13
# File 'lib/gamefic-standard/grammar/pronoun.rb', line 11

def subjective(entity)
  map(entity)[:subjective]
end

.subjective_(entity) ⇒ String Also known as: they_, he_, she_

Parameters:

  • entity (#person, #plural?, #gender)

Returns:

  • (String)


20
21
22
# File 'lib/gamefic-standard/grammar/pronoun.rb', line 20

def subjective_(entity)
  subjective(entity).cap_first
end