Class: TypeFactory
- Inherits:
-
Object
- Object
- TypeFactory
- Defined in:
- lib/arabic_conjugator/factories/type_factory.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #assimilated? ⇒ Boolean
- #assimilated_defective? ⇒ Boolean
- #assimilated_taa? ⇒ Boolean
- #defective? ⇒ Boolean
- #doubled? ⇒ Boolean
- #hollow? ⇒ Boolean
- #hollow_defective? ⇒ Boolean
-
#initialize(root1, root2, root3, form) ⇒ TypeFactory
constructor
A new instance of TypeFactory.
- #load_types ⇒ Object
- #morphed_taa? ⇒ Boolean
Constructor Details
#initialize(root1, root2, root3, form) ⇒ TypeFactory
Returns a new instance of TypeFactory.
6 7 8 9 10 11 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 6 def initialize(root1, root2, root3, form) @root1 = root1 @root2 = root2 @root3 = root3 @form = form end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 4 def type @type end |
Instance Method Details
#assimilated? ⇒ Boolean
47 48 49 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 47 def assimilated? @root1 == "و" || @root1 == "ي" end |
#assimilated_defective? ⇒ Boolean
27 28 29 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 27 def assimilated_defective? (@root1 == "و" || @root1 == "ي") && (@root3 == "و" || @root3 == "ي") end |
#assimilated_taa? ⇒ Boolean
51 52 53 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 51 def assimilated_taa? @form == "8" && ["ت", "ث", "د", "ط", "ظ"].include?(@root1) end |
#defective? ⇒ Boolean
39 40 41 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 39 def defective? @root3 == "و" || @root3 == "ي" end |
#doubled? ⇒ Boolean
43 44 45 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 43 def doubled? @root2 == @root3 end |
#hollow? ⇒ Boolean
35 36 37 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 35 def hollow? @root2 == "و" || @root2 == "ي" end |
#hollow_defective? ⇒ Boolean
31 32 33 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 31 def hollow_defective? (@root2 == "و" || @root2 == "ي") && (@root3 == "و" || @root3 == "ي") end |
#load_types ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 13 def load_types types = [] types << "assimilated defective" if assimilated_defective? types << "hollow defective" if hollow_defective? types << "defective" if defective? types << "hollow" if hollow? types << "doubled" if doubled? types << "assimilated" if assimilated? types << "assimilated_taa" if assimilated_taa? types << "morphed_taa" if morphed_taa? types << "regular" if types.empty? types end |
#morphed_taa? ⇒ Boolean
55 56 57 |
# File 'lib/arabic_conjugator/factories/type_factory.rb', line 55 def morphed_taa? @form == "8" && ["ذ", "ز", "ص", "ض"].include?(@root1) end |