Skip to content

Commit

Permalink
Better readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
arttu committed Nov 23, 2011
1 parent 519cdcb commit 9772ccd
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,23 @@ Add to Gemfile

## Usage

```# the most basic use case
fp = FeedParser.new(:url => "http://example.com/feed/")
# with sanitizer
fp = FeedParser.new(:url => "http://example.com/feed/", :sanitizer => MyBestestSanitizer.new)
# sanitizing custom field set
fp = FeedParser.new(:url => "http://example.com/feed/", :sanitizer => MyBestestSanitizer.new, :fields_to_sanitize => [:title, :content])
# parse the feed
feed = fp.parse
# using parsed feed in your code
feed.as_json
# => {:title => "Feed title", :url => "http://example.com/feed/", :items => [{:guid => , :title => , :author => ...}]}
feed.items.each do |feed_item|
pp feed_item
end
```
# the most basic use case
fp = FeedParser.new(:url => "http://example.com/feed/")
# with sanitizer
fp = FeedParser.new(:url => "http://example.com/feed/", :sanitizer => MyBestestSanitizer.new)
# sanitizing custom field set
fp = FeedParser.new(:url => "http://example.com/feed/", :sanitizer => MyBestestSanitizer.new, :fields_to_sanitize => [:title, :content])

# parse the feed
feed = fp.parse

# using parsed feed in your code
feed.as_json
# => {:title => "Feed title", :url => "http://example.com/feed/", :items => [{:guid => , :title => , :author => ...}]}

feed.items.each do |feed_item|
pp feed_item
end

## Running tests

Expand Down

0 comments on commit 9772ccd

Please sign in to comment.