module Grammar::Pronoun
Functions to select pronouns based on an entity's attributes, such as gender.
Public Class Methods
map(entity)
click to toggle source
@param entity [#person, plural?, gender] @return [Hash]
# 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)
click to toggle source
@param entity [#person, plural?, gender] @return [String]
# File lib/gamefic-standard/grammar/pronoun.rb, line 29 def objective(entity) map(entity)[:objective] end
Also aliased as: them
objective_(entity)
click to toggle source
@param entity [#person, plural?, gender] @return [String]
# File lib/gamefic-standard/grammar/pronoun.rb, line 36 def objective_(entity) objective(entity).cap_first end
Also aliased as: them_
possessive(entity)
click to toggle source
@param entity [#person, plural?, gender] @return [String]
# File lib/gamefic-standard/grammar/pronoun.rb, line 43 def possessive(entity) map(entity)[:possessive] end
Also aliased as: their
possessive_(entity)
click to toggle source
@param entity [#person, plural?, gender] @return [String]
# File lib/gamefic-standard/grammar/pronoun.rb, line 50 def possessive_(entity) possessive(entity).cap_first end
Also aliased as: their_
reflexive(entity)
click to toggle source
@param entity [#person, plural?, gender] @return [String]
# File lib/gamefic-standard/grammar/pronoun.rb, line 57 def reflexive(entity) map(entity)[:reflexive] end
Also aliased as: themselves, themself
reflexive_(entity)
click to toggle source
@param entity [#person, plural?, gender] @return [String]
# File lib/gamefic-standard/grammar/pronoun.rb, line 65 def reflexive_(entity) reflexive(entity).cap_first end
Also aliased as: themselves_, themself_
subjective(entity)
click to toggle source
@param entity [#person, plural?, gender] @return [String]
# File lib/gamefic-standard/grammar/pronoun.rb, line 11 def subjective(entity) map(entity)[:subjective] end
subjective_(entity)
click to toggle source
@param entity [#person, plural?, gender] @return [String]
# File lib/gamefic-standard/grammar/pronoun.rb, line 20 def subjective_(entity) subjective(entity).cap_first end
Private Class Methods
map_keys()
click to toggle source
# File lib/gamefic-standard/grammar/pronoun.rb, line 96 def map_keys @map_keys ||= %i[subjective objective possessive reflexive] end
maps()
click to toggle source
# File lib/gamefic-standard/grammar/pronoun.rb, line 81 def maps @maps ||= { [1, :singular] => Hash[map_keys.zip(%w[I me my myself])], [2, :singular] => Hash[map_keys.zip(%w[you you your yourself])], [3, :singular] => Hash[map_keys.zip(%w[it it its itself])], [3, :singular, :male] => Hash[map_keys.zip(%w[he him his himself])], [3, :singular, :female] => Hash[map_keys.zip(%w[she her her herself])], [3, :singular, :other] => Hash[map_keys.zip(%w[they them their themselves])], [3, :singular, :neutral] => Hash[map_keys.zip(%w[it it its itself])], [1, :plural] => Hash[map_keys.zip(%w[we us our ourselves])], [2, :plural] => Hash[map_keys.zip(%w[you you your yourselves])], [3, :plural] => Hash[map_keys.zip(%w[they them their themselves])] } end