lifestreamable 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -74,7 +74,7 @@
74
74
  #
75
75
  # == Options
76
76
  # Note, when using Proc for the options, the model that triggers the event is always passed to the Proc.
77
- # ex. Proc.new {|model| ... }
77
+ # ex. Proc.new {|model| ... }
78
78
  #
79
79
  # * :data => Required, Proc or function name to call to get the data that needs to be lifestreamed, the data should be in a type that is serializable by YAML (Hash, Array and Struct are good)
80
80
  # * :on => Required, Array of events that trigger the insertion into the lifestream, acceptable values are: :create, :update, :destroy
@@ -1,3 +1,32 @@
1
+ # :title: module Lifestreamable::Lifestreamed
2
+ #
3
+ # == OPTIONS:
4
+ # :order => Order in which the data is presented, by default, this is 'id desc', possible values are: true, false, Proc, function name. Proc receives the model as a parameter.
5
+ # :filter => boolean value, specifies whether or not to filter the data, possible values are: true, false, Proc, function name. Proc receives the model as a parameter.
6
+ #
7
+ # == USAGE:
8
+ # The lifestreamed module is included for models that own events, while the lifestreamable module is included on each model that triggers the event.
9
+ # class User < ActiveRecord::Base
10
+ # has_many :friends
11
+ # lifestreamed :order=>'id asc', :filter=>true
12
+ # end
13
+ #
14
+ # Whenever a new post is created, it will create a new entry in the lifestream model. To get the lifestream from the owner:
15
+ # user=User.first
16
+ #
17
+ # # get the lifestream for the user
18
+ # lifestream = user.lifestream({find_options}) #=> returns an array of Lifestreamable::Lifesteam model instances
19
+ # group_lifestream = user.group_lifestream([array_of owner_id], {find_options}) #=> returns an array of Lifestreamable::Lifesteam model instances
20
+ #
21
+ # #get the data that was stored
22
+ # data = lifestream.first.object_data
23
+ #
24
+ # The :option and :filter options can also be passed to the lifestream finder methods.
25
+ # group_friends = user.friends.collect {|f| f.id}
26
+ # lifestream = user.group_lifestream(group_friends, :filter=>false, :order=>'owner_type asc, owner_id desc')
27
+ #
28
+ #
29
+
1
30
  module Lifestreamable
2
31
  module Lifestreamed
3
32
  def self.included(base)
@@ -23,6 +52,7 @@ module Lifestreamable
23
52
  self.class.lifestreamed_options
24
53
  end
25
54
 
55
+ # Returns the lifestream values on the
26
56
  def lifestream(*options)
27
57
  opt, do_filter = get_options_and_filter(options[0])
28
58
  lifestream = Lifestreamable::Lifestream.find_lifestream_for_owner(self, opt)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{lifestreamable}
5
- s.version = "0.0.6"
5
+ s.version = "0.0.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Benoit Goyette"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 6
9
- version: 0.0.6
8
+ - 7
9
+ version: 0.0.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Benoit Goyette