Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update README to show new target functionality

  • Loading branch information...
commit 2718fa041c93901563e9e0b7560b47176a4c6358 1 parent 20c0114
Jason Webb authored June 02, 2012

Showing 1 changed file with 8 additions and 22 deletions. Show diff stats Hide diff stats

  1. 30  README.md
30  README.md
Source Rendered
... ...
@@ -1,6 +1,6 @@
1 1
 # Gypsy
2 2
 
3  
-A simple model loader for data that has no need to be in a database.
  3
+A simple loader for data that has no need to be in a database.
4 4
 
5 5
 ## Installation
6 6
 
@@ -18,32 +18,18 @@ Or install it yourself as:
18 18
 
19 19
 ## Usage
20 20
 
21  
-*Planned*
22  
-
23 21
 ### With Rails
24 22
 
25  
-Add to your Gemfile. Create your simple models. For example in `app/models/posts.rb`:
26  
-
27  
-``` ruby
28  
-class Post < Gypsy::Base
29  
-  attribute :title
30  
-  attribute :body
31  
-  attribute :tags
32  
-end
33  
-```
  23
+By default Gypsy works by convention.  Everyfile in `/app/data` will be loaded
  24
+into a model with the same name as the file.  So `posts.json` will load model
  25
+`Post`.  Simple.
34 26
 
35  
-Then create the data for it by creating a matching file in `app/data/posts.rb`:
  27
+All data is made available as enumerables on the model they loaded from as the
  28
+class method `rows`.  This makes accessing the data very easy:
36 29
 
37  
-``` ruby
38  
-record :post do
39  
-  title "A blog post."
40  
-  body "Here is a body of a post."
41  
-  tags_collection do
42  
-
43  
-  end
44  
-end
  30
+```ruby
  31
+Posts.rows.find{|p| p.is_published}
45 32
 ```
46  
-
47 33
 ## Contributing
48 34
 
49 35
 1. Fork it

0 notes on commit 2718fa0

Please sign in to comment.
Something went wrong with that request. Please try again.