Permalink
Browse files

Add syntax highlighting

  • Loading branch information...
1 parent 112ea8d commit 0c4b2eea3738a74a18728c60a260378b474daf37 6twenty committed Aug 22, 2011
Showing with 26 additions and 18 deletions.
  1. +26 −18 README.md
View
44 README.md
@@ -11,38 +11,46 @@ Inspired by [Crafting Rails Applications](http://pragprog.com/book/jvrails/craft
## Example
- json = MyExternalApi.call('/some/path.json')
- attributes_hash = JSON.decode(json)
-
- # => {'name' => 'Michael', 'email' => 'michael@example.com'}
+```ruby
+json = MyExternalApi.call('/some/path.json')
+attributes_hash = JSON.decode(json)
- class SampleModel < ModestModel::Base
- attributes :name, :email
- end
-
- SampleModel.new(attributes_hash)
-
- # => #<SampleModel @name="Michael"...
+# => {'name' => 'Michael', 'email' => 'michael@example.com'}
+
+class SampleModel < ModestModel::Base
+ attributes :name, :email
+end
+
+SampleModel.new(attributes_hash)
+
+# => #<SampleModel @name="Michael"...
+```
## Installation
ModestModel has been tested and works on MRI 1.8.7 and 1.9.2.
### Rubygems
- gem install modest_model
-
+```ruby
+gem install modest_model
+```
+
### Bundler
- gem 'modest_model'
-
+```ruby
+gem 'modest_model'
+```
+
### Usage
Similar to ActiveRecord models, simply create a class which inherits from `ModestModel::Base`. You'll need to define some attributes - this is achieved by calling the `attributes` method passing in the attribute names you require:
- class SampleModel < ModestModel::Base
- attributes :name, :email
- end
+```ruby
+class SampleModel < ModestModel::Base
+ attributes :name, :email
+end
+```
## Features

0 comments on commit 0c4b2ee

Please sign in to comment.