php-serialization 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +29 -0
- data/VERSION +1 -1
- data/php-serialization.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -2,6 +2,35 @@
|
|
2
2
|
|
3
3
|
Ruby implementation of PHP's serialization. This is special useful for reading PHP session files.
|
4
4
|
|
5
|
+
== Serialization examples
|
6
|
+
|
7
|
+
Primitive values
|
8
|
+
|
9
|
+
PhpSerialization.dump(10) # => "i:10;"
|
10
|
+
PhpSerialization.dump("Name") # => "s:4:\"Name\";"
|
11
|
+
PhpSerialization.dump(true) # => "b:1;"
|
12
|
+
PhpSerialization.dump(nil) # => "N;"
|
13
|
+
|
14
|
+
Array
|
15
|
+
|
16
|
+
PhpSerialization.dump([true, "foo"]) # => "a:2:{i:0;b:1;i:1;s:3:\"foo\";};"
|
17
|
+
|
18
|
+
Hash
|
19
|
+
|
20
|
+
PhpSerialization.dump("name" => "Rodrigo", "age" => 23) # => "a:2:{s:4:\"name\";s:7:\"Rodrigo\";s:3:\"age\";i:23;};"
|
21
|
+
|
22
|
+
Object
|
23
|
+
|
24
|
+
class Person
|
25
|
+
attr_accessor :name, :age
|
26
|
+
end
|
27
|
+
|
28
|
+
person = Person.new
|
29
|
+
person.name = "Rodrigo"
|
30
|
+
person.age = 23
|
31
|
+
|
32
|
+
PhpSerialization.dump(person) # => "O:6:\"Person\":2:{s:4:\"name\";s:7:\"Rodrigo\";s:3:\"age\";i:23;};"
|
33
|
+
|
5
34
|
== Unserialization examples
|
6
35
|
|
7
36
|
Primitive values
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/php-serialization.gemspec
CHANGED