Module: Lifestream
- Defined in:
- lib/lifestream.rb,
lib/lifestream/branch.rb,
lib/lifestream/source.rb,
lib/lifestream/stream.rb,
lib/lifestream/channel.rb,
lib/lifestream/request.rb,
lib/lifestream/channel/rss2.rb
Defined Under Namespace
Classes: Branch, Channel, NoConfiguration, Request, Source, Stream
Class Method Summary collapse
-
.options ⇒ Object
Provides configurability to Lifestream.
-
.run(preload = false) ⇒ Object
Generates a Lifestream::Stream which contains all the channels with their branches parsed from the feeds in the lifestream.yml file, ordered by their published_at date.
Class Method Details
.options ⇒ Object
Provides configurability to Lifestream. There are a number of options available, such as:
-
whiny: Will raise an error if Lifestream cannot process a given feed.
Defaults to true
-
config: Path to the lifestream.yml file that contains the feeds to download. Defaults to gem location, you will probably want to set this
11 12 13 14 15 16 |
# File 'lib/lifestream.rb', line 11 def self. @options ||= { :config => 'lifestream.yml', :whiny => true } end |
.run(preload = false) ⇒ Object
Generates a Lifestream::Stream which contains all the channels with their branches parsed from the feeds in the lifestream.yml file, ordered by their published_at date.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/lifestream.rb', line 21 def self.run(preload = false) lifestream = Lifestream::Stream.new ensure_configuration_exists feeds = YAML.load(File.open([:config])) feeds.each_pair do |name, | klass = Lifestream::Channel.const_get(['format']) channel = klass.new(name, ['url']) channel.branches if preload lifestream.channels << channel end lifestream end |