Module: ActivityStream::Actor
- Defined in:
- lib/activity_stream/actor.rb
Overview
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#activity_stream(name = :default) ⇒ Object
Creates and returns an ActivityStream::Stream for the predefined list of actors.
-
#followed_actors ⇒ Object
Override this to change the default actors.
- #publish_activity(name, metadata = {}) ⇒ Object
Class Method Details
.included(base) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/activity_stream/actor.rb', line 24 def self.included(base) base.extend(ClassMethods) base.class_eval do has_many :activities, :as => :actor activity_stream(:default, :actors => :followed_actors) activity_stream(:self, :actors => :self) end end |
Instance Method Details
#activity_stream(name = :default) ⇒ Object
Creates and returns an ActivityStream::Stream for the predefined list of actors.
43 44 45 |
# File 'lib/activity_stream/actor.rb', line 43 def activity_stream(name = :default) ActivityStream::Stream.new(name, self, self.class.defined_streams[name]) end |
#followed_actors ⇒ Object
Override this to change the default actors
47 48 49 |
# File 'lib/activity_stream/actor.rb', line 47 def followed_actors self.class.all.map{|actor| [actor.class, actor.id]} end |
#publish_activity(name, metadata = {}) ⇒ Object
34 35 36 37 38 |
# File 'lib/activity_stream/actor.rb', line 34 def publish_activity(name, = {}) activity = ::Activity.(name, ) self.activities << activity activity end |