README.md in craft-0.0.1 vs README.md in craft-0.0.2
- old
+ new
@@ -1,29 +1,37 @@
# Craft
-TODO: Write a gem description
+Craft XML and HTML into objects.
-## Installation
+## Examples
+```ruby
+require 'craft'
+require 'open-uri'
-Add this line to your application's Gemfile:
+class Page < Craft
+ # Use CSS selectors
+ one :title, 'title'
- gem 'craft'
+ # Use XPath
+ many :links, 'a/@href'
-And then execute:
+ # Perform transforms on returned nodes
+ many :images, 'img', lambda { |img| img.attr('src').upcase }
+end
- $ bundle
+page = Page.parse open('http://www.google.com')
-Or install it yourself as:
+page.title #=> 'Google'
+page.links #=> ['http://www.google.com/imghp?hl=en&tab=wi', ...]
+page.images #=> ['/LOGOS/2012/MOBY_DICK12-HP.JPG']
- $ gem install craft
+class Script < Craft
+ one :body, 'text()'
+end
-## Usage
+class Page < Craft
+ many :scripts, 'script', Script
+end
-TODO: Write usage instructions here
-
-## Contributing
-
-1. Fork it
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Commit your changes (`git commit -am 'Add some feature'`)
-4. Push to the branch (`git push origin my-new-feature`)
-5. Create new Pull Request
+page = Page.parse open('http://www.google.com')
+page.scripts[0].body #=> 'window.google=...'
+```