Class: Params::Crypter

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/params/crypter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#password=(value) ⇒ Object

Sets the attribute password

Parameters:

  • value

    the value to set the attribute password to.



34
35
36
# File 'lib/params/crypter.rb', line 34

def password=(value)
  @password = value
end

Class Method Details

.off!Object



13
14
15
# File 'lib/params/crypter.rb', line 13

def off!
	@on = false
end

.off?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/params/crypter.rb', line 21

def off?
	!on?
end

.on!Object



9
10
11
# File 'lib/params/crypter.rb', line 9

def on!
	@on = true
end

.on?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/params/crypter.rb', line 17

def on?
	!(@on == false)
end

.passwordObject



25
26
27
# File 'lib/params/crypter.rb', line 25

def password
	Params::Crypter.instance.password
end

.password=(pass) ⇒ Object



29
30
31
# File 'lib/params/crypter.rb', line 29

def password= pass
	Params::Crypter.instance.password = pass
end

Instance Method Details

#decrypt(data) ⇒ Object



49
50
51
52
# File 'lib/params/crypter.rb', line 49

def decrypt data
	return data if off?
	cipher.dec data
end

#encrypt(data) ⇒ Object



44
45
46
47
# File 'lib/params/crypter.rb', line 44

def encrypt data
	return data if off?
	cipher.enc data
end

#off?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/params/crypter.rb', line 40

def off?
	Params::Crypter.off?
end

#on?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/params/crypter.rb', line 36

def on?
	Params::Crypter.on?
end