Class: Rumanu::Numerology

Inherits:
Object
  • Object
show all
Includes:
Rumanu
Defined in:
lib/rumanu/numerology.rb

Constant Summary

Constants included from Rumanu

CONSONANTS, VERSION, VOWELS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Rumanu

#digit_sum, #reduce_list, #valid_date?, #valid_hash?

Constructor Details

#initialize(name = 'Vance Louis Wheeler', dob = '03/08/1944') ⇒ Numerology

Returns a new instance of Numerology.



8
9
10
11
12
13
14
# File 'lib/rumanu/numerology.rb', line 8

def initialize(name = 'Vance Louis Wheeler', dob = '03/08/1944')
  @vowels = VOWELS
  @consonants = CONSONANTS
  @alphabet = @vowels.merge @consonants
  @name = name
  @dob = dob
end

Instance Attribute Details

#alphabetObject (readonly)

Returns the value of attribute alphabet.



6
7
8
# File 'lib/rumanu/numerology.rb', line 6

def alphabet
  @alphabet
end

#consonantsObject

Returns the value of attribute consonants.



6
7
8
# File 'lib/rumanu/numerology.rb', line 6

def consonants
  @consonants
end

#dobObject

Returns the value of attribute dob.



6
7
8
# File 'lib/rumanu/numerology.rb', line 6

def dob
  @dob
end

#vowelsObject

Returns the value of attribute vowels.



6
7
8
# File 'lib/rumanu/numerology.rb', line 6

def vowels
  @vowels
end

Instance Method Details

#destinyObject



39
40
41
42
43
44
45
# File 'lib/rumanu/numerology.rb', line 39

def destiny
  r = dob.split(%r{\.|-|/}).inject(0) { |sum, element| sum + element.to_i }
  value = digit_sum(r)
  return value unless value.to_s.length > 1

  digit_sum(value)
end

#expressionObject

Sum of all name’s characters



58
59
60
# File 'lib/rumanu/numerology.rb', line 58

def expression
  reduce_list(prep_name, @alphabet)
end

#motivationObject

Sum of all name’s vowels



48
49
50
# File 'lib/rumanu/numerology.rb', line 48

def motivation
  reduce_list(prep_name, @vowels)
end

#nameObject



21
22
23
# File 'lib/rumanu/numerology.rb', line 21

def name
  @name.split.map(&:capitalize).join(' ').dup
end

#name=(name) ⇒ Object



16
17
18
19
# File 'lib/rumanu/numerology.rb', line 16

def name=(name)
  validate_name(name)
  @name = name
end

#personalityObject

Sum of all name’s consonants



53
54
55
# File 'lib/rumanu/numerology.rb', line 53

def personality
  reduce_list(prep_name, @consonants)
end