Class: Base

Inherits:
Object
  • Object
show all
Defined in:
lib/arabic_conjugator/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(verb) ⇒ Base

Returns a new instance of Base.



8
9
10
11
12
13
14
15
16
17
# File 'lib/arabic_conjugator/base.rb', line 8

def initialize(verb)
  @types = verb.types[0]
  @root1 = verb.root1
  @root2 = verb.root2
  @root3 = verb.root3
  @pronoun = verb.pronoun
  adjust_first_radical if @root1 == "ء"
  adjust_second_radical if @root2 == "ء"
  adjust_third_radical if @root3 == "ء"
end

Instance Method Details

#adjust_first_radicalObject



66
67
68
# File 'lib/arabic_conjugator/base.rb', line 66

def adjust_first_radical
  @root1 = "أ"
end

#assimilated_baseObject



38
39
40
# File 'lib/arabic_conjugator/base.rb', line 38

def assimilated_base
  @base
end

#assimilated_defective_baseObject



58
59
60
# File 'lib/arabic_conjugator/base.rb', line 58

def assimilated_defective_base
  defective_base
end

#defective_baseObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/arabic_conjugator/base.rb', line 27

def defective_base
  @base = @base[0...-1]
  if @pronoun == :he
    @base + "ى"
  elsif [:she, :they].include?(@pronoun)
    @base
  else
    @base + "ي"
  end
end

#doubled_baseObject



50
51
52
53
54
55
56
# File 'lib/arabic_conjugator/base.rb', line 50

def doubled_base
  if [:he, :she, :they].include?(@pronoun)
    @base[0...-1] + "ّ"
  else
    @base
  end
end

#hollow_baseObject



42
43
44
45
46
47
48
# File 'lib/arabic_conjugator/base.rb', line 42

def hollow_base
  if @root3 == "أ" && @pronoun == :they
    @base[0...-1] + "ؤ"
  else
    @base
  end
end

#hollow_defective_baseObject



62
63
64
# File 'lib/arabic_conjugator/base.rb', line 62

def hollow_defective_base
  defective_base
end

#regular_baseObject



19
20
21
22
23
24
25
# File 'lib/arabic_conjugator/base.rb', line 19

def regular_base
  if @root3 == "أ" && @pronoun == :they
    @base[0...-1] + "ؤ"
  else
    @base
  end
end