Improved project description.
[ruby-eet.git] / README
1 --
2 $Id: README 7 2005-03-27 01:23:15Z tilman $
3 ++
4
5 = ruby-eet -- Ruby bindings for EET
6
7 ruby-eet allows you to read and write EET files from Ruby code.
8 Support for Ruby object serialization in EDD (EET Data Descriptor) format
9 is given.
10
11 ruby-eet is maintained by:
12
13 :include: AUTHORS
14
15 == License
16
17 ruby-eet is available under an MIT-style license.
18
19 :include: COPYING
20
21 == Download
22
23 The latest version of ruby-eet can be found at
24 http://code-monkey.de/projects/ruby-efl.html
25
26 Online documentation is available at
27 http://code-monkey.de/docs/ruby-eet
28
29 == Dependencies
30
31 ruby-eet depends on Rake[http://rake.rubyforge.org] 0.5.0 or greater
32 and EET[http://www.enlightenment.org].
33
34 == Installation
35
36 Run "rake install" to install ruby-eet.
37
38 == Usage
39
40 === Basics
41
42 Each entry in an EET file consists of an unique key and the data that's
43 associated with that key.
44
45 First, you have to open an EET file by calling Eet::File.open.
46
47 Now, you can store arbitrary data in the EET file with Eet::File#write.
48 To read the data from the EET file, use Eet::File#read.
49
50 If you want to store/retrieve image data, see Eet::File#read_image and
51 Eet::File#write_image.
52
53 === Serializing objects
54
55 ruby-eet also supports the serialization of objects which uses the same
56 format as the C API uses for its EET data descriptors.
57 At the time of this writing, deserialization, i.e. read support, isn't
58 implemented yet, though.
59
60 Example:
61
62   class Foo
63     def initialize
64       @str = "bar"
65       @int = 1024
66     end
67   end
68
69 Now, Foo.new.to_eet will serialize the object into EET format.
70 All of the objects instance variables will be serialized, and the class
71 name will be used as the tag.
72
73 To override the tag, you just need to implement Foo#to_eet_name:
74
75   class Foo
76     def to_eet_name
77       "Blah"
78     end
79   end
80
81 To control what information is stored for an object, override the method
82 to_eet_properties.
83
84 to_eet_properties returns a hash containing keys that are the names of
85 the stored properties. Each hash value is an array that contains the
86 value to store at least. Optionally, it can also contain a type specifier
87 to enforce specific encoding.
88
89 ==== Type specifiers
90
91 For fixnums and bignums, the valid type specifiers are :char, :short,
92 :long_long which enforce encoding as 1 byte, 2 byte or 8 byte value
93 respectively. The default is to encode the value as a 4 byte value.
94
95 For floats, the valid type specifier is :double, which enforces encoding
96 as an 8 byte value. The default is to encode the value as a 4 byte value.