README.md in maxwell-0.2.0 vs README.md in maxwell-0.3.0
- old
+ new
@@ -19,22 +19,25 @@
$ gem install maxwell
## Usage
```ruby
-Maxwell::DO({
- "root url" => {
- "css selector to links" => {
- "css selector to links" => ->(html) {
- html.title
- # write parser here
- }
- }
- }
-}) do |result|
- p result
- # write code for handling results
+class YahooScraper < Maxwell::Base
+ attr_scrape :title, :url, :address
+
+ regist_strategy("h3.slcHead.cFix a") do
+ @title = @html.title
+ @url = @html.css("td.sdhk jdj").text
+ @address = @html.css("table tr.ddad").text
+ end
+
+ regist_handler do |result|
+ p result
+ end
+
end
+
+YahooScraper.new.execute("https://www.yahoo.com/")
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec maxwell` to use the gem in this directory, ignoring other installed copies of this gem.