Nico-Taing/yaml_record — Issue #4: Add property type casting
Author: nesquena
Created: 2012-02-01 08:47:43+00:00
State: open

Old property declaration is:

```ruby
class Post < YamlRecord::Base
# Declare your properties
properties :title, :body, :user_id
end
```

which leaves the properties as whatever types they are inside the YAML. But we should support type casting as well:

```ruby
class Post < YamlRecord::Base
# Declare your properties
property :title, String
property :body, String
property :user_id, Integer
property :enabled, Boolean
property :created_at, DateTime
end
```

This should typecast for `String`, `Integer`, `DateTime`, and `Boolean`. This means that it will serialize and deserialize and properly cast types:

```ruby
p = Post.new(:title => "Test", :user_id => "6", :enabled => "1", :created_at => "6/18/2012")
p.title # => "Test"
p.user_id # => 6
p.enabled # => true
p.created_at # =>
```

and also properly write types out:

```yaml
---
title: "Test"
user_id : 6
enabled : true
created_at: "2011-11-05T08:15:30Z"
```