Module: Parsel::JSON

Defined in:
lib/parsel/json.rb

Class Method Summary collapse

Class Method Details

.decrypt(*args) ⇒ Object



8
9
10
11
12
13
# File 'lib/parsel/json.rb', line 8

def self.decrypt(*args)
  key, iv, data = Parsel.expand_args(args)
  ::JSON.load Parsel.decrypt(key, iv, data)
rescue Exception
  false
end

.encrypt(*args) ⇒ Object



3
4
5
6
# File 'lib/parsel/json.rb', line 3

def self.encrypt(*args)
  key, iv, data = Parsel.expand_args(args)
  Parsel.encrypt(key, iv, ::JSON.dump(data))
end