README.md in representable-1.3.1 vs README.md in representable-1.3.2

- old
+ new

@@ -53,11 +53,24 @@ It also adds support for parsing. song = Song.new.extend(SongRepresenter).from_json(%{ {"title":"Roxanne"} }) #=> #<Song title="Roxanne", track=nil> +## Aliasing +If your property name doesn't match the name in the document, use the `:as` option. + + module SongRepresenter + include Representable::JSON + + property :title, as: :name + property :track + end + + song.to_json #=> {"name":"Fallout","track":1} + + ## Wrapping Let the representer know if you want wrapping. module SongRepresenter @@ -432,21 +445,9 @@ property :title property :track, if: lambda { track > 0 } end When rendering or parsing, the `track` property is considered only if track is valid. Note that the block is executed in instance context, giving you access to instance methods. - - -### Mapping - -If your property name doesn't match the attribute name in the document, use the `:as` option. - - module SongRepresenter - property :title - property :track, as: :track_number - end - - song.to_json #=> {"title":"Superstars","track_number":1} ### False and Nil Values Since representable-1.2 `false` values _are_ considered when parsing and rendering. That particularly means properties that used to be unset (i.e. `nil`) after parsing might be `false` now. Vice versa, `false` properties that weren't included in the rendered document will be visible now.