Module: FollowSystem::Followee

Extended by:
ActiveSupport::Concern
Defined in:
lib/follow_system/followee.rb

Overview

Followee module

This module defines followee behavior in follow system

Instance Method Summary collapse

Instance Method Details

#followed_by?(follower) ⇒ Boolean

Specifies if self is followed by a FollowSystem::Follower object

Parameters:

Returns:

  • (Boolean)


43
44
45
# File 'lib/follow_system/followee.rb', line 43

def followed_by?(follower)
  Follow.follows?(follower, self)
end

#followers_by(klass) ⇒ ActiveRecord::Relation

Retrieves a scope of FollowSystem::Follow objects that follows self filtered FollowSystem::Follower type

Parameters:

  • klass (Class)
    • the Class to filter

Returns:

  • (ActiveRecord::Relation)


53
54
55
# File 'lib/follow_system/followee.rb', line 53

def followers_by(klass)
  Follow.scope_by_followee(self).scope_by_follower_type(klass)
end

#is_followee?Boolean

Specifies if self can be followed by FollowSystem::Follower objects

Returns:

  • (Boolean)


33
34
35
# File 'lib/follow_system/followee.rb', line 33

def is_followee?
  true
end