Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 78 lines (52 sloc) 1.752 kb
03298fe @mojombo first solid state
mojombo authored
1 BERT
2 ====
41ebc43 @mojombo Initial commit to bert.
mojombo authored
3
c55e9c6 @mojombo readme tweaks
mojombo authored
4 A BERT (Binary ERlang Term) serialization library for Ruby. It can
03298fe @mojombo first solid state
mojombo authored
5 encode Ruby objects into BERT format and decode BERT binaries into Ruby
6 objects.
7
d0f3687 @mojombo oops, markdown not textile
mojombo authored
8 See the BERT specification at [bert-rpc.org](http://bert-rpc.org).
fb52e18 @mojombo readme fixes
mojombo authored
9
c55e9c6 @mojombo readme tweaks
mojombo authored
10 Instances of the following Ruby classes will be automatically converted to the
11 proper simple BERT type:
6b1ed4f @mojombo update readme with acceptable ruby types
mojombo authored
12
13 * Fixnum
14 * Float
15 * Symbol
16 * Array
17 * String
18
c55e9c6 @mojombo readme tweaks
mojombo authored
19 Instances of the following Ruby classes will be automatically converted to the
20 proper complex BERT type:
6b1ed4f @mojombo update readme with acceptable ruby types
mojombo authored
21
22 * NilClass
23 * TrueClass
24 * FalseClass
25 * Hash
26 * Time
27 * Regexp
28
c55e9c6 @mojombo readme tweaks
mojombo authored
29 To designate tuples, simply prefix an Array literal with a `t` or use the
30 BERT::Tuple class:
3550e53 @mojombo mention l
mojombo authored
31
a13f874 @mojombo switch to explicitly declaring tuples instead of lists
mojombo authored
32 t[:foo, [1, 2, 3]]
c55e9c6 @mojombo readme tweaks
mojombo authored
33 BERT::Tuple[:foo, [1, 2, 3]]
3550e53 @mojombo mention l
mojombo authored
34
a13f874 @mojombo switch to explicitly declaring tuples instead of lists
mojombo authored
35 Both of these will be converted to (in Erlang syntax):
3550e53 @mojombo mention l
mojombo authored
36
37 {foo, [1, 2, 3]}
38
03298fe @mojombo first solid state
mojombo authored
39
40 Installation
41 ------------
42
43 gem install bert -s http://gemcutter.org
44
45
46 Usage
47 -----
48
49 require 'bert'
50
29b4751 @mojombo add time object to bert test
mojombo authored
51 bert = BERT.encode(t[:user, {:name => 'TPW', :nick => 'mojombo'}])
fb52e18 @mojombo readme fixes
mojombo authored
52 # => "\203h\002d\000\004userh\002d\000\004dictl\000\000\000\002h\002d
53 \000\004namem\000\000\000\003TPWh\002d\000\004nickm\000\000\000
54 \amojomboj"
6aa3226 @mojombo better readme
mojombo authored
55
56 BERT.decode(bert)
fb52e18 @mojombo readme fixes
mojombo authored
57 # => t[:user, {:name=>"TPW", :nick=>"mojombo"}]
6aa3226 @mojombo better readme
mojombo authored
58
03298fe @mojombo first solid state
mojombo authored
59
60
61 Note on Patches/Pull Requests
62 -----------------------------
41ebc43 @mojombo Initial commit to bert.
mojombo authored
63
64 * Fork the project.
65 * Make your feature addition or bug fix.
66 * Add tests for it. This is important so I don't break it in a
67 future version unintentionally.
68 * Commit, do not mess with rakefile, version, or history.
69 (if you want to have your own version, that is fine but
70 bump version in a commit by itself I can ignore when I pull)
71 * Send me a pull request. Bonus points for topic branches.
72
03298fe @mojombo first solid state
mojombo authored
73
74 Copyright
75 ---------
41ebc43 @mojombo Initial commit to bert.
mojombo authored
76
77 Copyright (c) 2009 Tom Preston-Werner. See LICENSE for details.
Something went wrong with that request. Please try again.