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
-
cache: The path that the downloaded feeds should be cached in, defaults to tmp Set cache to false to disable it
-
cache_expiration: The amount of time that the cache is fresh for Defaults to 1 hour
15 16 17 18 19 20 21 22 |
# File 'lib/lifestream.rb', line 15 def self. @options ||= { :config => 'lifestream.yml', :whiny => true, :cache => 'tmp', :cache_expiration => (60 * 60 * 1) } 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.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/lifestream.rb', line 27 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 |