Module: BookmarkSystem::Bookmarkee

Extended by:
ActiveSupport::Concern
Defined in:
lib/bookmark_system/bookmarkee.rb

Overview

Bookmarkee module

This module defines bookmarkee behavior in bookmark system

Instance Method Summary collapse

Instance Method Details

#bookmarked_by?(bookmarker) ⇒ Boolean

Specifies if self is bookmarked by a BookmarkSystem::Bookmarker object

Parameters:

Returns:

  • (Boolean)


43
44
45
# File 'lib/bookmark_system/bookmarkee.rb', line 43

def bookmarked_by?(bookmarker)
  Bookmark.bookmarks?(bookmarker, self)
end

#bookmarkers_by(klass) ⇒ ActiveRecord::Relation

Retrieves a scope of BookmarkSystem::Bookmark objects that bookmarks self filtered BookmarkSystem::Bookmarker type

Parameters:

  • klass (Class)
    • the Class to filter

Returns:

  • (ActiveRecord::Relation)


53
54
55
# File 'lib/bookmark_system/bookmarkee.rb', line 53

def bookmarkers_by(klass)
  Bookmark.scope_by_bookmarkee(self).scope_by_bookmarker_type(klass)
end

#is_bookmarkee?Boolean

Specifies if self can be bookmarked by BookmarkSystem::Bookmarker objects

Returns:

  • (Boolean)


33
34
35
# File 'lib/bookmark_system/bookmarkee.rb', line 33

def is_bookmarkee?
  true
end