lib/socialization/actors/mentioner.rb in socialization-0.5.0.beta4 vs lib/socialization/actors/mentioner.rb in socialization-1.0.0
- old
+ new
@@ -25,29 +25,29 @@
# Create a new {Mention mention} relationship.
#
# @param [Mentionable] mentionable the object to be mentioned.
# @return [Boolean]
def mention!(mentionable)
- raise ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
+ raise Socialization::ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
Socialization.mention_model.mention!(self, mentionable)
end
# Delete a {Mention mention} relationship.
#
# @param [Mentionable] mentionable the object to unmention.
# @return [Boolean]
def unmention!(mentionable)
- raise ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
+ raise Socialization::ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
Socialization.mention_model.unmention!(self, mentionable)
end
# Toggles a {Mention mention} relationship.
#
# @param [Mentionable] mentionable the object to mention/unmention.
# @return [Boolean]
def toggle_mention!(mentionable)
- raise ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
+ raise Socialization::ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
if mentions?(mentionable)
unmention!(mentionable)
false
else
mention!(mentionable)
@@ -58,11 +58,11 @@
# Specifies if self mentions a {Mentionable} object.
#
# @param [Mentionable] mentionable the {Mentionable} object to test against.
# @return [Boolean]
def mentions?(mentionable)
- raise ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
+ raise Socialization::ArgumentError, "#{mentionable} is not mentionable!" unless mentionable.respond_to?(:is_mentionable?) && mentionable.is_mentionable?
Socialization.mention_model.mentions?(self, mentionable)
end
# Returns all the mentionables of a certain type that are mentioned by self
#
@@ -83,6 +83,6 @@
Socialization.mention_model.mentionables_relation(self, klass, opts)
end
alias :mentionees_relation :mentionables_relation
end
end
-end
+end
\ No newline at end of file