-
Notifications
You must be signed in to change notification settings - Fork 67
Open
Description
Summary
Add methods to filter and search items by common criteria.
Proposed Features
items_since(time)
Filter items published after a given time:
def items_since(time)
items.select do |item|
date = item[:pubDate] || item[:updated] || item[:published]
date && date > time
end
endUsage:
rss.items_since(1.day.ago)
rss.items_since(Time.parse('2024-01-01'))items_by_category(name)
Filter items by category:
def items_by_category(name)
items.select do |item|
cat = item[:category]
case cat
when Array then cat.any? { |c| c.to_s.downcase.include?(name.downcase) }
when String then cat.downcase.include?(name.downcase)
end
end
endUsage:
rss.items_by_category('technology')search(query)
Simple text search across title and description:
def search(query)
pattern = Regexp.new(Regexp.escape(query), Regexp::IGNORECASE)
items.select do |item|
[item[:title], item[:description], item[:summary], item[:content]].any? do |field|
field.to_s =~ pattern
end
end
endUsage:
rss.search('ruby')
rss.search('breaking news')Benefits
- Common operations without manual filtering
- Consistent date handling across RSS/Atom formats
- Case-insensitive matching by default
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels