Module: ActiveRecord::Acts::MuckFriendUser::InstanceMethods
- Defined in:
- lib/active_record/acts/muck_friend_user.rb
Overview
All the methods available to a record that has had acts_as_muck_friend
specified.
Instance Method Summary collapse
-
#become_friends_with(user) ⇒ Object
Assume that ‘user’ is already following the current user.
-
#block_user(user) ⇒ Object
Block a user.
- #blocked?(user) ⇒ Boolean
-
#drop_friend(user) ⇒ Object
Call to remove friend or follower.
-
#feed_to ⇒ Object
Feed to friends and followers.
-
#follow(user) ⇒ Object
Follow the given user.
-
#followed_by?(user) ⇒ Boolean
Indicates whether the given user is following the current user.
-
#following?(user) ⇒ Boolean
Indicates whether the given user is being followed by the current user.
-
#friend_of?(user) ⇒ Boolean
Indicates whether or not the give user is a friend.
- #friendship_with(user) ⇒ Object
-
#has_network? ⇒ Boolean
Indicates whether the user has any followers or friends or if they are following anybody.
-
#stop_following(user) ⇒ Object
Call to stop following another user.
- #unblock_user(user) ⇒ Object
Instance Method Details
#become_friends_with(user) ⇒ Object
Assume that ‘user’ is already following the current user
56 57 58 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 56 def become_friends_with(user) Friend.make_friends(self, user) end |
#block_user(user) ⇒ Object
Block a user. This prevents them from getting updates.
89 90 91 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 89 def block_user(user) Friend.block_user(self, user) end |
#blocked?(user) ⇒ Boolean
65 66 67 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 65 def blocked?(user) Friend.blocked?(self, user) end |
#drop_friend(user) ⇒ Object
Call to remove friend or follower. If following is enabled the user specified by ‘user’ will become a follower of self.
80 81 82 83 84 85 86 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 80 def drop_friend(user) if GlobalConfig.enable_following Friend.revert_to_follower(self, user) else Friend.stop_being_friends(self, user) end end |
#feed_to ⇒ Object
Feed to friends and followers
46 47 48 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 46 def feed_to @feed_to_users ||= [self] | self.friends | self.followers # prevent duplicates in the array end |
#follow(user) ⇒ Object
Follow the given user
61 62 63 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 61 def follow(user) Friend.add_follower(self, user) end |
#followed_by?(user) ⇒ Boolean
Indicates whether the given user is following the current user
98 99 100 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 98 def followed_by?(user) followers.include?(user) end |
#following?(user) ⇒ Boolean
Indicates whether the given user is being followed by the current user
103 104 105 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 103 def following?(user) followings.include?(user) end |
#friend_of?(user) ⇒ Boolean
Indicates whether or not the give user is a friend
51 52 53 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 51 def friend_of?(user) friends.include?(user) end |
#friendship_with(user) ⇒ Object
69 70 71 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 69 def friendship_with(user) Friend.friendship_with(self, user) end |
#has_network? ⇒ Boolean
Indicates whether the user has any followers or friends or if they are following anybody
108 109 110 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 108 def has_network? Friend.has_network?(self) end |
#stop_following(user) ⇒ Object
Call to stop following another user
74 75 76 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 74 def stop_following(user) Friend.stop_following(self, user) end |
#unblock_user(user) ⇒ Object
93 94 95 |
# File 'lib/active_record/acts/muck_friend_user.rb', line 93 def unblock_user(user) Friend.unblock_user(self, user) end |