Module: Grammar::Pronoun

Extended by:
Pronoun
Included in:
Pronoun
Defined in:
lib/gamefic-standard/grammar/pronoun.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#map(entity) ⇒ Hash

Parameters:

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

Returns:

  • (Hash)


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

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)


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

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

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

Parameters:

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

Returns:

  • (String)


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

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

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

Parameters:

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

Returns:

  • (String)


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

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

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

Parameters:

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

Returns:

  • (String)


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

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

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

Parameters:

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

Returns:

  • (String)


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

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

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

Parameters:

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

Returns:

  • (String)


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

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

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

Parameters:

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

Returns:

  • (String)


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

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

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

Parameters:

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

Returns:

  • (String)


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

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