Class: Rumanu::Numerology
- Inherits:
-
Object
- Object
- Rumanu::Numerology
- Includes:
- Rumanu
- Defined in:
- lib/rumanu/numerology.rb
Constant Summary
Constants included from Rumanu
Instance Attribute Summary collapse
-
#alphabet ⇒ Object
readonly
Returns the value of attribute alphabet.
-
#consonants ⇒ Object
Returns the value of attribute consonants.
-
#dob ⇒ Object
Returns the value of attribute dob.
-
#vowels ⇒ Object
Returns the value of attribute vowels.
Instance Method Summary collapse
- #destiny ⇒ Object
-
#expression ⇒ Object
Sum of all name’s characters.
-
#initialize(name = 'Vance Louis Wheeler', dob = '03/08/1944') ⇒ Numerology
constructor
A new instance of Numerology.
-
#motivation ⇒ Object
Sum of all name’s vowels.
- #name ⇒ Object
- #name=(name) ⇒ Object
-
#personality ⇒ Object
Sum of all name’s consonants.
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
#alphabet ⇒ Object (readonly)
Returns the value of attribute alphabet.
6 7 8 |
# File 'lib/rumanu/numerology.rb', line 6 def alphabet @alphabet end |
#consonants ⇒ Object
Returns the value of attribute consonants.
6 7 8 |
# File 'lib/rumanu/numerology.rb', line 6 def consonants @consonants end |
#dob ⇒ Object
Returns the value of attribute dob.
6 7 8 |
# File 'lib/rumanu/numerology.rb', line 6 def dob @dob end |
#vowels ⇒ Object
Returns the value of attribute vowels.
6 7 8 |
# File 'lib/rumanu/numerology.rb', line 6 def vowels @vowels end |
Instance Method Details
#destiny ⇒ Object
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 |
#expression ⇒ Object
Sum of all name’s characters
58 59 60 |
# File 'lib/rumanu/numerology.rb', line 58 def expression reduce_list(prep_name, @alphabet) end |
#motivation ⇒ Object
Sum of all name’s vowels
48 49 50 |
# File 'lib/rumanu/numerology.rb', line 48 def motivation reduce_list(prep_name, @vowels) end |
#name ⇒ Object
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 |
#personality ⇒ Object
Sum of all name’s consonants
53 54 55 |
# File 'lib/rumanu/numerology.rb', line 53 def personality reduce_list(prep_name, @consonants) end |