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 |
# 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) end end |
Instance Method Details
#activity_stream(name = :default) ⇒ Object
Creates and returns an ActivityStream::Stream for the predefined list of actors.
42 43 44 |
# File 'lib/activity_stream/actor.rb', line 42 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
46 47 48 |
# File 'lib/activity_stream/actor.rb', line 46 def followed_actors self.class.all.map{|actor| [actor.class, actor.id]} end |
#publish_activity(name, metadata = {}) ⇒ Object
33 34 35 36 37 |
# File 'lib/activity_stream/actor.rb', line 33 def publish_activity(name, = {}) activity = ::Activity.(name, ) self.activities << activity activity end |