A Simple Feed Aggregator : RSS Network Ruby


require 'rss/2.0'
require 'open-uri'

url = 'http://www.oreillynet.com/pub/feed/1?format=rss2'
feed = RSS::Parser.parse(open(url).read, false)
puts "#{feed.channel.title}"
feed.items.each do |item|
  puts item.title
  puts " (#{item.link})"
  puts
  puts item.description
end

 

ARGV and ARGF : ARGF Development Ruby


ARGV << "myFile.txt"
print while gets

# ARGV (or $*) is an array, and each of its elements is a filename submitted on the command line. 
# You can apply any method to ARGV that you might apply to any other array. 


p ARGV # => ["sonnet_119.txt"]

# or:

ARGV#[0] # => ["sonnet_119.txt"]