class EnigmaEncrypto::DateOffsetGen

Attributes

todays_date[RW]

Public Class Methods

new() click to toggle source
# File lib/enigma_encrypto/dateoffset_gen.rb, line 7
def initialize
  @todays_date = Time.now.strftime("%02d%02m%02y")
end

Public Instance Methods

get_decrypter_offset(date) click to toggle source
# File lib/enigma_encrypto/dateoffset_gen.rb, line 15
def get_decrypter_offset(date)
  @todays_date = date
  date_squared_last_four
end
get_offset() click to toggle source
# File lib/enigma_encrypto/dateoffset_gen.rb, line 11
def get_offset
  date_squared_last_four
end

Private Instance Methods

date_squared_last_four() click to toggle source
# File lib/enigma_encrypto/dateoffset_gen.rb, line 22
def date_squared_last_four
  (@todays_date.to_i**2).to_s.split("").slice(-4..-1).map do |num|
    num.to_i
  end
end