Method: Atom::Tools#parse_input

Defined in:
lib/atom/tools.rb

#parse_input(source, options) ⇒ Object

turns a collection of Atom Entries into an Array of Atom::Entrys

source: a URL, a directory or “-” for an Atom Feed on stdin options:

:complete - whether to fetch the complete logical feed
:user - username to use for HTTP requests (if required)
:pass - password to use for HTTP requests (if required)


76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/atom/tools.rb', line 76

def parse_input source, options
  entries = if source.match /^http/
           http = Atom::HTTP.new

           setup_http http, options

           http_to_entries source, options[:complete], http
         elsif source == '-'
           stdin_to_entries
         else
           dir_to_entries source
         end

  if options[:verbose]
    entries.each do |entry|
      puts "got #{entry.title}"
    end
  end

  entries
end