module BookmarkSystem::Bookmarker
Bookmarker
module
This module defines bookmarker behavior in bookmark system
Public Instance Methods
Creates a {Bookmark} relationship between self and a {Bookmarkee} object
@param [Bookmarkee] bookmarkee - the bookmarkee of the {Bookmark} relationship @return [Boolean]
# File lib/bookmark_system/bookmarker.rb, line 43 def bookmark(bookmarkee) Bookmark.bookmark(self, bookmarkee) end
Retrieves a scope of {Bookmark} objects that are bookmarked by self
@param [Class] klass - the {Class} to include @return [ActiveRecord::Relation]
# File lib/bookmark_system/bookmarker.rb, line 83 def bookmarkees_by(klass) Bookmark.scope_by_bookmarker(self).scope_by_bookmarkee_type(klass) end
Specifies if self bookmarks a {Bookmarker} object
@param [Bookmarkee] bookmarkee - the {Bookmarkee} object to test against @return [Boolean]
# File lib/bookmark_system/bookmarker.rb, line 73 def bookmarks?(bookmarkee) Bookmark.bookmarks?(self, bookmarkee) end
Specifies if self can bookmark {Bookmarkee} objects
@return [Boolean]
# File lib/bookmark_system/bookmarker.rb, line 33 def is_bookmarker? true end
Toggles a {Bookmark} relationship between self and a {Bookmarkee} object
@param [Bookmarkee] bookmarkee - the bookmarkee of the {Bookmark} relationship @return [Boolean]
# File lib/bookmark_system/bookmarker.rb, line 63 def toggle_bookmark(bookmarkee) Bookmark.toggle_bookmark(self, bookmarkee) end
Destroys a {Bookmark} relationship between self and a {Bookmarkee} object
@param [Bookmarkee] bookmarkee - the bookmarkee of the {Bookmark} relationship @return [Boolean]
# File lib/bookmark_system/bookmarker.rb, line 53 def unbookmark(bookmarkee) Bookmark.unbookmark(self, bookmarkee) end