Class: Rumanu::Numerology

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

Constant Summary

Constants included from Rumanu

PY_CONSONANTS, PY_VOWELS, VERSION

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.



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

def initialize(name="Vance Louis Wheeler",dob="03/08/1944")
  @vowels = PY_VOWELS
  @consonants = PY_CONSONANTS
  @alphabet = @vowels.merge @consonants
  @name = name
  @dob = dob
end

Instance Attribute Details

#alphabetObject (readonly)

Returns the value of attribute alphabet.



4
5
6
# File 'lib/rumanu/numerology.rb', line 4

def alphabet
  @alphabet
end

#consonantsObject

Returns the value of attribute consonants.



4
5
6
# File 'lib/rumanu/numerology.rb', line 4

def consonants
  @consonants
end

#dobObject

Returns the value of attribute dob.



4
5
6
# File 'lib/rumanu/numerology.rb', line 4

def dob
  @dob
end

#vowelsObject

Returns the value of attribute vowels.



4
5
6
# File 'lib/rumanu/numerology.rb', line 4

def vowels
  @vowels
end

Instance Method Details

#destinyObject



44
45
46
47
48
49
# File 'lib/rumanu/numerology.rb', line 44

def destiny
  r = dob.split(/\.|-|\//).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



62
63
64
# File 'lib/rumanu/numerology.rb', line 62

def expression
  reduce_list(prep_name, @alphabet)
end

#motivationObject

Sum of all name’s vowels



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

def motivation
  reduce_list(prep_name, @vowels)
end

#nameObject



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

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

#name=(name) ⇒ Object



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

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

end

#personalityObject

Sum of all name’s consonants



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

def personality
  reduce_list(prep_name, @consonants)
end