Module: Firebug
- Defined in:
- lib/firebug.rb,
lib/firebug/crypto.rb,
lib/firebug/session.rb,
lib/firebug/version.rb,
lib/firebug/serializer.rb,
lib/firebug/unserializer.rb,
lib/firebug/configuration.rb
Defined Under Namespace
Classes: Configuration, Crypto, ParserError, Serializer, Session, Unserializer
Constant Summary collapse
- VERSION =
'0.1.10'
Class Attribute Summary collapse
Class Method Summary collapse
- .configure {|config| ... } ⇒ Object
-
.decrypt(data, key = nil) ⇒ Object
Decrypt data encrypted using CodeIgniters encryption.
-
.decrypt_cookie(data) ⇒ Object
Decodes the base64 encoded string, decrypts, and unserializes.
-
.encrypt(data, key = nil) ⇒ Object
Encrypt data the way CodeIgniter does.
-
.encrypt_cookie(data) ⇒ String
Serializes, encrypts, and base64 encodes the data.
-
.serialize(value) ⇒ String
Serialize a ruby object into a PHP serialized string.
-
.unserialize(value) ⇒ Object
Unserialize a PHP serialized string into a ruby object.
Class Attribute Details
.configuration ⇒ Firebug::Configuration
16 17 18 |
# File 'lib/firebug.rb', line 16 def self.configuration @configuration ||= Configuration.new end |
Class Method Details
.configure {|config| ... } ⇒ Object
21 22 23 |
# File 'lib/firebug.rb', line 21 def self.configure yield configuration end |
.decrypt(data, key = nil) ⇒ Object
Decrypt data encrypted using CodeIgniters encryption.
54 55 56 57 |
# File 'lib/firebug.rb', line 54 def self.decrypt(data, key=nil) key = configuration.key if key.nil? Crypto.new(key).decrypt(data) end |
.decrypt_cookie(data) ⇒ Object
Decodes the base64 encoded string, decrypts, and unserializes.
71 72 73 74 |
# File 'lib/firebug.rb', line 71 def self.(data) return {} if data.nil? Firebug.unserialize(Firebug.decrypt(Base64.strict_decode64(data))) end |
.encrypt(data, key = nil) ⇒ Object
Encrypt data the way CodeIgniter does.
45 46 47 48 |
# File 'lib/firebug.rb', line 45 def self.encrypt(data, key=nil) key = configuration.key if key.nil? Crypto.new(key).encrypt(data) end |
.encrypt_cookie(data) ⇒ String
Serializes, encrypts, and base64 encodes the data.
63 64 65 |
# File 'lib/firebug.rb', line 63 def self.(data) Base64.strict_encode64(Firebug.encrypt(Firebug.serialize(data))) end |
.serialize(value) ⇒ String
Serialize a ruby object into a PHP serialized string.
29 30 31 |
# File 'lib/firebug.rb', line 29 def self.serialize(value) Serializer.parse(value) end |
.unserialize(value) ⇒ Object
Unserialize a PHP serialized string into a ruby object.
37 38 39 |
# File 'lib/firebug.rb', line 37 def self.unserialize(value) Unserializer.parse(value) end |