Class: ActivityStream::Stream

Inherits:
Object
  • Object
show all
Defined in:
lib/activity_stream/stream.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, actor, opts = {}) ⇒ Stream

Returns a new instance of Stream.

Parameters:

  • name (String)

    the name of the Stream

  • actor (ActivityStream::Actor)
  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :actors (Symbol) — default: :activity_stream_actors

    the method on the user that should return an Array of [ActorClass, actor_id] items.



9
10
11
12
13
# File 'lib/activity_stream/stream.rb', line 9

def initialize(name, actor, opts = {})
  @name = name
  @actor = actor
  @collection = initialize_collection(opts[:actors])
end

Instance Method Details

#activities(reload = false) ⇒ Object

Returns the activities for the collection of actors.

Parameters:

  • reload (Boolean) (defaults to: false)

    Return to the database for new activities

Returns:

  • the activities for the collection of actors



17
18
19
20
21
22
23
# File 'lib/activity_stream/stream.rb', line 17

def activities(reload = false)
  if @activities && !reload
    @activities 
  else 
    @activities = ::Activity.by_actors(@collection)
  end
end