Class: SimpleFeed::Activity::SingleUser

Inherits:
Base
  • Object
show all
Includes:
Enumerable
Defined in:
lib/simplefeed/activity/single_user.rb

Overview

Lazy implementation of SingleUser based on delegating an array of one user_id to MultiUser

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_id:, feed:) ⇒ SingleUser

Returns a new instance of SingleUser.


74
75
76
77
78
# File 'lib/simplefeed/activity/single_user.rb', line 74

def initialize(user_id:, feed:)
  @feed              = feed
  @user_id           = user_id
  self.user_activity = MultiUser.new(feed: feed, user_ids: [user_id])
end

Instance Attribute Details

#user_activityObject

Returns the value of attribute user_activity


11
12
13
# File 'lib/simplefeed/activity/single_user.rb', line 11

def user_activity
  @user_activity
end

#user_idObject (readonly)

Returns the value of attribute user_id


10
11
12
# File 'lib/simplefeed/activity/single_user.rb', line 10

def user_id
  @user_id
end

Instance Method Details

#each {|user_id| ... } ⇒ Object

Yields:


15
16
17
# File 'lib/simplefeed/activity/single_user.rb', line 15

def each
  yield(user_id)
end