class Params::Crypter

Attributes

password[W]

Public Class Methods

off!() click to toggle source
# File lib/params/crypter.rb, line 13
def off!
        @on = false
end
off?() click to toggle source
# File lib/params/crypter.rb, line 21
def off?
        !on?
end
on!() click to toggle source
# File lib/params/crypter.rb, line 9
def on!
        @on = true
end
on?() click to toggle source
# File lib/params/crypter.rb, line 17
def on?
        !(@on == false)
end
password() click to toggle source
# File lib/params/crypter.rb, line 25
def password
        Params::Crypter.instance.password
end
password=(pass) click to toggle source
# File lib/params/crypter.rb, line 29
def password= pass
        Params::Crypter.instance.password = pass
end

Public Instance Methods

decrypt(data) click to toggle source
# File lib/params/crypter.rb, line 49
def decrypt data
        return data if off?
        cipher.dec data
end
encrypt(data) click to toggle source
# File lib/params/crypter.rb, line 44
def encrypt data
        return data if off?
        cipher.enc data
end
off?() click to toggle source
# File lib/params/crypter.rb, line 40
def off?
        Params::Crypter.off?
end
on?() click to toggle source
# File lib/params/crypter.rb, line 36
def on?
        Params::Crypter.on?
end

Protected Instance Methods

cipher() click to toggle source
# File lib/params/crypter.rb, line 56
def cipher
        @cipher ||= Gibberish::AES.new(password)
end
password() click to toggle source
# File lib/params/crypter.rb, line 60
def password
        @password ||= 'xyZ1/!2kdi9o_#'
end