Sha256: 225f52199269711f4d0e807b5f74dfb284ad5b7b8ed941607252c084495461d7
Contents?: true
Size: 832 Bytes
Versions: 2
Compression:
Stored size: 832 Bytes
Contents
require 'tinynews' require 'tinynews/feed' require 'yaml' module TinyNews class Feeds def initialize @sources = TinyNews.sources_from_home end def generate source_symbol feeds = [] case source_symbol when :all @sources.keys.each do |symbol| feeds << generate_feed_object_for( symbol ) end when *@sources.keys feeds << generate_feed_object_for( source_symbol ) else source_unavailable source_symbol end feeds end private def source_unavailable source_symbol puts "Sorry, specified source: '#{source_symbol}' is unavailable" end def generate_feed_object_for feed_symbol source = @sources[feed_symbol] source == nil ? nil : Feed.new( source[:title], source[:url] ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tinynews-1.0.3 | lib/tinynews/feeds.rb |
tinynews-1.0.2 | lib/tinynews/feeds.rb |