Class: Gamefic::Grammar::Pronouns
- Inherits:
-
Object
- Object
- Gamefic::Grammar::Pronouns
- Defined in:
- lib/gamefic/grammar/pronouns.rb
Class Method Summary collapse
-
.get_pronoun_set(obj) ⇒ Array<String>
Get a an array of pronouns based on the person, gender, and plurality of the provided object.
-
.sets ⇒ Object
TODO Consider implementing method_missing to determine correct pronoun from example, e.g., “he” would change to “she” for female entities.
Instance Method Summary collapse
-
#initialize(object) ⇒ Pronouns
constructor
A new instance of Pronouns.
-
#obj ⇒ String
Get the objective pronoun (me, them, us, etc.).
-
#Obj ⇒ String
Get the capitalized objective pronoun.
-
#poss ⇒ String
Get the possessive pronoun (my, your, our, etc.).
-
#Poss ⇒ String
Get the capitalized possessive pronoun.
-
#reflex ⇒ String
Get the reflexive pronoun (myself, yourself, etc.).
-
#Reflex ⇒ String
Get the capitalized reflexive pronoun.
-
#Subj ⇒ String
Get the capitalized subjective pronoun.
-
#subj ⇒ String
Get the subjective pronoun (I, you, we, etc.).
Constructor Details
#initialize(object) ⇒ Pronouns
Returns a new instance of Pronouns.
6 7 8 |
# File 'lib/gamefic/grammar/pronouns.rb', line 6 def initialize object @object = object end |
Class Method Details
.get_pronoun_set(obj) ⇒ Array<String>
Get a an array of pronouns based on the person, gender, and plurality of the provided object.
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/gamefic/grammar/pronouns.rb', line 71 def self.get_pronoun_set(obj) set = Pronouns.sets["#{obj.person}"] if set.nil? set = Pronouns.sets["#{obj.person}:#{obj.plural? ? 'plural' : 'singular'}"] end if set.nil? set = Pronouns.sets["#{obj.person}:#{obj.plural? ? 'plural' : 'singular'}:#{obj.gender}"] end if set.nil? raise "Pronoun set could not be determined" end set end |
.sets ⇒ Object
TODO Consider implementing method_missing to determine correct pronoun from example, e.g., “he” would change to “she” for female entities
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/gamefic/grammar/pronouns.rb', line 87 def self.sets if @sets.nil? @sets = {} @sets["1:singular"] = ["I", "me", "my", "myself"] @sets["2:singular"] = ["you", "you", "your", "yourself"] @sets["3:singular:male"] = ["he", "him", "his", "himself"] @sets["3:singular:female"] = ["she", "her", "her", "herself"] # "other" refers to a person or living being that is neither # male or female or for whom gender is unspecified. It's # typically used to avoid referring to a person as "it." @sets["3:singular:other"] = ["they", "them", "their", "themselves"] @sets["3:singular:neutral"] = ["it", "it", "its", "itself"] @sets["1:plural"] = ["we", "us", "our", "ourselves"] @sets["2:plural"] = ["you", "you", "your", "yourselves"] @sets["3:plural"] = ["they", "them", "their", "themselves"] end @sets end |
Instance Method Details
#obj ⇒ String
Get the objective pronoun (me, them, us, etc.)
20 21 22 |
# File 'lib/gamefic/grammar/pronouns.rb', line 20 def obj Pronouns.get_pronoun_set(@object)[1] end |
#Obj ⇒ String
Get the capitalized objective pronoun
48 49 50 |
# File 'lib/gamefic/grammar/pronouns.rb', line 48 def Obj obj.cap_first end |
#poss ⇒ String
Get the possessive pronoun (my, your, our, etc.)
27 28 29 |
# File 'lib/gamefic/grammar/pronouns.rb', line 27 def poss Pronouns.get_pronoun_set(@object)[2] end |
#Poss ⇒ String
Get the capitalized possessive pronoun
55 56 57 |
# File 'lib/gamefic/grammar/pronouns.rb', line 55 def Poss poss.cap_first end |
#reflex ⇒ String
Get the reflexive pronoun (myself, yourself, etc.)
34 35 36 |
# File 'lib/gamefic/grammar/pronouns.rb', line 34 def reflex Pronouns.get_pronoun_set(@object)[3] end |
#Reflex ⇒ String
Get the capitalized reflexive pronoun
62 63 64 |
# File 'lib/gamefic/grammar/pronouns.rb', line 62 def Reflex reflex.cap_first end |
#Subj ⇒ String
Get the capitalized subjective pronoun
41 42 43 |
# File 'lib/gamefic/grammar/pronouns.rb', line 41 def Subj subj.cap_first end |
#subj ⇒ String
Get the subjective pronoun (I, you, we, etc.)
13 14 15 |
# File 'lib/gamefic/grammar/pronouns.rb', line 13 def subj Pronouns.get_pronoun_set(@object)[0] end |