socialization 0.5.0.beta2 → 0.5.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -186,7 +186,10 @@ Toggle
186
186
  Mentions?
187
187
 
188
188
  comment.mentions?(user)
189
+
190
+ All mentionees
189
191
 
192
+ comment.mentionees(User)
190
193
 
191
194
  ***
192
195
 
@@ -3,6 +3,7 @@ module ActiveRecord
3
3
  def is_follower?
4
4
  false
5
5
  end
6
+ alias follower? is_follower?
6
7
  end
7
8
  end
8
9
 
@@ -17,6 +18,7 @@ module Socialization
17
18
  def is_follower?
18
19
  true
19
20
  end
21
+ alias follower? is_follower?
20
22
 
21
23
  # Create a new {Follow follow} relationship.
22
24
  #
@@ -3,6 +3,7 @@ module ActiveRecord
3
3
  def is_liker?
4
4
  false
5
5
  end
6
+ alias liker? is_liker?
6
7
  end
7
8
  end
8
9
 
@@ -17,6 +18,7 @@ module Socialization
17
18
  def is_liker?
18
19
  true
19
20
  end
21
+ alias liker? is_liker?
20
22
 
21
23
  # Create a new {Like like} relationship.
22
24
  #
@@ -3,6 +3,7 @@ module ActiveRecord
3
3
  def is_mentioner?
4
4
  false
5
5
  end
6
+ alias mentioner? is_mentioner?
6
7
  end
7
8
  end
8
9
 
@@ -17,6 +18,7 @@ module Socialization
17
18
  def is_mentioner?
18
19
  true
19
20
  end
21
+ alias mentioner? is_mentioner?
20
22
 
21
23
  # Create a new {Mention mention} relationship.
22
24
  #
@@ -3,10 +3,8 @@ module Socialization
3
3
  def follow_model
4
4
  if @follow_model
5
5
  @follow_model
6
- elsif defined?(::Follow)
7
- ::Follow
8
6
  else
9
- raise RuntimeError.new("No Follow model has been defined.")
7
+ ::Follow
10
8
  end
11
9
  end
12
10
 
@@ -17,10 +15,8 @@ module Socialization
17
15
  def like_model
18
16
  if @like_model
19
17
  @like_model
20
- elsif defined?(::Like)
21
- ::Like
22
18
  else
23
- raise RuntimeError.new("No Like model has been defined.")
19
+ ::Like
24
20
  end
25
21
  end
26
22
 
@@ -31,10 +27,8 @@ module Socialization
31
27
  def mention_model
32
28
  if @mention_model
33
29
  @mention_model
34
- elsif defined?(::Mention)
35
- ::Mention
36
30
  else
37
- raise RuntimeError.new("No Mention model has been defined.")
31
+ ::Mention
38
32
  end
39
33
  end
40
34
 
@@ -1,8 +1,9 @@
1
1
  module Socialization
2
2
  module ActiveRecordStores
3
3
  class Follow < ActiveRecord::Base
4
- include Socialization::ActiveRecordStores::Mixins::Base
5
- include Socialization::Stores::Mixins::Follow
4
+ extend Socialization::Stores::Mixins::Base
5
+ extend Socialization::Stores::Mixins::Follow
6
+ extend Socialization::ActiveRecordStores::Mixins::Base
6
7
 
7
8
  belongs_to :follower, :polymorphic => true
8
9
  belongs_to :followable, :polymorphic => true
@@ -24,9 +25,7 @@ module Socialization
24
25
  follow.follower = follower
25
26
  follow.followable = followable
26
27
  end
27
- call_after_create_hook(follower, followable)
28
- follower.touch if [:all, :follower].include?(touch) && follower.respond_to?(:touch)
29
- followable.touch if [:all, :followable].include?(touch) && followable.respond_to?(:touch)
28
+ call_after_create_hooks(follower, followable)
30
29
  true
31
30
  else
32
31
  false
@@ -36,9 +35,7 @@ module Socialization
36
35
  def unfollow!(follower, followable)
37
36
  if follows?(follower, followable)
38
37
  follow_for(follower, followable).destroy_all
39
- call_after_destroy_hook(follower, followable)
40
- follower.touch if [:all, :follower].include?(touch) && follower.respond_to?(:touch)
41
- followable.touch if [:all, :followable].include?(touch) && followable.respond_to?(:touch)
38
+ call_after_destroy_hooks(follower, followable)
42
39
  true
43
40
  else
44
41
  false
@@ -101,34 +98,7 @@ module Socialization
101
98
  end
102
99
  end
103
100
 
104
- def touch(what = nil)
105
- if what.nil?
106
- @touch || false
107
- else
108
- raise ArgumentError unless [:all, :follower, :followable, false, nil].include?(what)
109
- @touch = what
110
- end
111
- end
112
-
113
- def after_follow(method)
114
- raise ArgumentError unless method.is_a?(Symbol) || method.nil?
115
- @after_create_hook = method
116
- end
117
-
118
- def after_unfollow(method)
119
- raise ArgumentError unless method.is_a?(Symbol) || method.nil?
120
- @after_destroy_hook = method
121
- end
122
-
123
101
  private
124
- def call_after_create_hook(follower, followable)
125
- self.send(@after_create_hook, follower, followable) if @after_create_hook
126
- end
127
-
128
- def call_after_destroy_hook(follower, followable)
129
- self.send(@after_destroy_hook, follower, followable) if @after_destroy_hook
130
- end
131
-
132
102
  def follow_for(follower, followable)
133
103
  followed_by(follower).following(followable)
134
104
  end
@@ -1,8 +1,9 @@
1
1
  module Socialization
2
2
  module ActiveRecordStores
3
3
  class Like < ActiveRecord::Base
4
- include Socialization::ActiveRecordStores::Mixins::Base
5
- include Socialization::Stores::Mixins::Like
4
+ extend Socialization::Stores::Mixins::Base
5
+ extend Socialization::Stores::Mixins::Like
6
+ extend Socialization::ActiveRecordStores::Mixins::Base
6
7
 
7
8
  belongs_to :liker, :polymorphic => true
8
9
  belongs_to :likeable, :polymorphic => true
@@ -24,9 +25,7 @@ module Socialization
24
25
  like.liker = liker
25
26
  like.likeable = likeable
26
27
  end
27
- call_after_create_hook(liker, likeable)
28
- liker.touch if [:all, :liker].include?(touch) && liker.respond_to?(:touch)
29
- likeable.touch if [:all, :likeable].include?(touch) && likeable.respond_to?(:touch)
28
+ call_after_create_hooks(liker, likeable)
30
29
  true
31
30
  else
32
31
  false
@@ -36,9 +35,7 @@ module Socialization
36
35
  def unlike!(liker, likeable)
37
36
  if likes?(liker, likeable)
38
37
  like_for(liker, likeable).destroy_all
39
- call_after_destroy_hook(liker, likeable)
40
- liker.touch if [:all, :liker].include?(touch) && liker.respond_to?(:touch)
41
- likeable.touch if [:all, :likeable].include?(touch) && likeable.respond_to?(:touch)
38
+ call_after_destroy_hooks(liker, likeable)
42
39
  true
43
40
  else
44
41
  false
@@ -101,34 +98,7 @@ module Socialization
101
98
  end
102
99
  end
103
100
 
104
- def touch(what = nil)
105
- if what.nil?
106
- @touch || false
107
- else
108
- raise ArgumentError unless [:all, :liker, :likeable, false, nil].include?(what)
109
- @touch = what
110
- end
111
- end
112
-
113
- def after_like(method)
114
- raise ArgumentError unless method.is_a?(Symbol) || method.nil?
115
- @after_create_hook = method
116
- end
117
-
118
- def after_unlike(method)
119
- raise ArgumentError unless method.is_a?(Symbol) || method.nil?
120
- @after_destroy_hook = method
121
- end
122
-
123
101
  private
124
- def call_after_create_hook(liker, likeable)
125
- self.send(@after_create_hook, liker, likeable) if @after_create_hook
126
- end
127
-
128
- def call_after_destroy_hook(liker, likeable)
129
- self.send(@after_destroy_hook, liker, likeable) if @after_destroy_hook
130
- end
131
-
132
102
  def like_for(liker, likeable)
133
103
  liked_by(liker).liking( likeable)
134
104
  end
@@ -1,8 +1,9 @@
1
1
  module Socialization
2
2
  module ActiveRecordStores
3
3
  class Mention < ActiveRecord::Base
4
- include Socialization::ActiveRecordStores::Mixins::Base
5
- include Socialization::Stores::Mixins::Mention
4
+ extend Socialization::Stores::Mixins::Base
5
+ extend Socialization::Stores::Mixins::Mention
6
+ extend Socialization::ActiveRecordStores::Mixins::Base
6
7
 
7
8
  belongs_to :mentioner, :polymorphic => true
8
9
  belongs_to :mentionable, :polymorphic => true
@@ -24,9 +25,7 @@ module Socialization
24
25
  mention.mentioner = mentioner
25
26
  mention.mentionable = mentionable
26
27
  end
27
- call_after_create_hook(mentioner, mentionable)
28
- mentioner.touch if [:all, :mentioner].include?(touch) && mentioner.respond_to?(:touch)
29
- mentionable.touch if [:all, :mentionable].include?(touch) && mentionable.respond_to?(:touch)
28
+ call_after_create_hooks(mentioner, mentionable)
30
29
  true
31
30
  else
32
31
  false
@@ -36,9 +35,7 @@ module Socialization
36
35
  def unmention!(mentioner, mentionable)
37
36
  if mentions?(mentioner, mentionable)
38
37
  mention_for(mentioner, mentionable).destroy_all
39
- call_after_destroy_hook(mentioner, mentionable)
40
- mentioner.touch if [:all, :mentioner].include?(touch) && mentioner.respond_to?(:touch)
41
- mentionable.touch if [:all, :mentionable].include?(touch) && mentionable.respond_to?(:touch)
38
+ call_after_destroy_hooks(mentioner, mentionable)
42
39
  true
43
40
  else
44
41
  false
@@ -101,34 +98,7 @@ module Socialization
101
98
  end
102
99
  end
103
100
 
104
- def touch(what = nil)
105
- if what.nil?
106
- @touch || false
107
- else
108
- raise ArgumentError unless [:all, :mentioner, :mentionable, false, nil].include?(what)
109
- @touch = what
110
- end
111
- end
112
-
113
- def after_mention(method)
114
- raise ArgumentError unless method.is_a?(Symbol) || method.nil?
115
- @after_create_hook = method
116
- end
117
-
118
- def after_unmention(method)
119
- raise ArgumentError unless method.is_a?(Symbol) || method.nil?
120
- @after_destroy_hook = method
121
- end
122
-
123
101
  private
124
- def call_after_create_hook(mentioner, mentionable)
125
- self.send(@after_create_hook, mentioner, mentionable) if @after_create_hook
126
- end
127
-
128
- def call_after_destroy_hook(mentioner, mentionable)
129
- self.send(@after_destroy_hook, mentioner, mentionable) if @after_destroy_hook
130
- end
131
-
132
102
  def mention_for(mentioner, mentionable)
133
103
  mentioned_by(mentioner).mentioning(mentionable)
134
104
  end
@@ -2,7 +2,6 @@ module Socialization
2
2
  module ActiveRecordStores
3
3
  module Mixins
4
4
  module Base
5
- include Socialization::Stores::Mixins::Base
6
5
  end
7
6
  end
8
7
  end
@@ -2,8 +2,20 @@ module Socialization
2
2
  module Stores
3
3
  module Mixins
4
4
  module Base
5
- @@after_create_hook = nil
6
- @@after_destroy_hook = nil
5
+ def touch_dependents(actor, victim)
6
+ actor.touch if touch_actor?(actor)
7
+ victim.touch if touch_victim?(victim)
8
+ end
9
+
10
+ def touch_actor?(actor)
11
+ return false unless actor.respond_to?(:touch)
12
+ touch == :all || touch.to_s =~ /er$/i
13
+ end
14
+
15
+ def touch_victim?(victim)
16
+ return false unless victim.respond_to?(:touch)
17
+ touch == :all || touch.to_s =~ /able$/i
18
+ end
7
19
  end
8
20
  end
9
21
  end
@@ -2,6 +2,37 @@ module Socialization
2
2
  module Stores
3
3
  module Mixins
4
4
  module Follow
5
+
6
+ public
7
+ def touch(what = nil)
8
+ if what.nil?
9
+ @touch || false
10
+ else
11
+ raise ArgumentError unless [:all, :follower, :followable, false, nil].include?(what)
12
+ @touch = what
13
+ end
14
+ end
15
+
16
+ def after_follow(method)
17
+ raise ArgumentError unless method.is_a?(Symbol) || method.nil?
18
+ @after_create_hook = method
19
+ end
20
+
21
+ def after_unfollow(method)
22
+ raise ArgumentError unless method.is_a?(Symbol) || method.nil?
23
+ @after_destroy_hook = method
24
+ end
25
+
26
+ protected
27
+ def call_after_create_hooks(follower, followable)
28
+ self.send(@after_create_hook, follower, followable) if @after_create_hook
29
+ touch_dependents(follower, followable)
30
+ end
31
+
32
+ def call_after_destroy_hooks(follower, followable)
33
+ self.send(@after_destroy_hook, follower, followable) if @after_destroy_hook
34
+ touch_dependents(follower, followable)
35
+ end
5
36
  end
6
37
  end
7
38
  end
@@ -2,6 +2,38 @@ module Socialization
2
2
  module Stores
3
3
  module Mixins
4
4
  module Like
5
+
6
+ public
7
+ def touch(what = nil)
8
+ if what.nil?
9
+ @touch || false
10
+ else
11
+ raise ArgumentError unless [:all, :liker, :likeable, false, nil].include?(what)
12
+ @touch = what
13
+ end
14
+ end
15
+
16
+ def after_like(method)
17
+ raise ArgumentError unless method.is_a?(Symbol) || method.nil?
18
+ @after_create_hook = method
19
+ end
20
+
21
+ def after_unlike(method)
22
+ raise ArgumentError unless method.is_a?(Symbol) || method.nil?
23
+ @after_destroy_hook = method
24
+ end
25
+
26
+ protected
27
+ def call_after_create_hooks(liker, likeable)
28
+ self.send(@after_create_hook, liker, likeable) if @after_create_hook
29
+ touch_dependents(liker, likeable)
30
+ end
31
+
32
+ def call_after_destroy_hooks(liker, likeable)
33
+ self.send(@after_destroy_hook, liker, likeable) if @after_destroy_hook
34
+ touch_dependents(liker, likeable)
35
+ end
36
+
5
37
  end
6
38
  end
7
39
  end
@@ -2,6 +2,38 @@ module Socialization
2
2
  module Stores
3
3
  module Mixins
4
4
  module Mention
5
+
6
+ public
7
+ def touch(what = nil)
8
+ if what.nil?
9
+ @touch || false
10
+ else
11
+ raise ArgumentError unless [:all, :mentioner, :mentionable, false, nil].include?(what)
12
+ @touch = what
13
+ end
14
+ end
15
+
16
+ def after_mention(method)
17
+ raise ArgumentError unless method.is_a?(Symbol) || method.nil?
18
+ @after_create_hook = method
19
+ end
20
+
21
+ def after_unmention(method)
22
+ raise ArgumentError unless method.is_a?(Symbol) || method.nil?
23
+ @after_destroy_hook = method
24
+ end
25
+
26
+ protected
27
+ def call_after_create_hooks(mentioner, mentionable)
28
+ self.send(@after_create_hook, mentioner, mentionable) if @after_create_hook
29
+ touch_dependents(mentioner, mentionable)
30
+ end
31
+
32
+ def call_after_destroy_hooks(mentioner, mentionable)
33
+ self.send(@after_destroy_hook, mentioner, mentionable) if @after_destroy_hook
34
+ touch_dependents(mentioner, mentionable)
35
+ end
36
+
5
37
  end
6
38
  end
7
39
  end
@@ -3,8 +3,9 @@
3
3
  module Socialization
4
4
  module RedisStores
5
5
  class Follow < Socialization::RedisStores::Base
6
- include Socialization::RedisStores::Mixins::Base
7
- include Socialization::Stores::Mixins::Follow
6
+ extend Socialization::Stores::Mixins::Base
7
+ extend Socialization::Stores::Mixins::Follow
8
+ extend Socialization::RedisStores::Mixins::Base
8
9
 
9
10
  class << self
10
11
  def follow!(follower, followable)
@@ -12,9 +13,7 @@ module Socialization
12
13
  Socialization.redis.sadd generate_followers_key(follower, followable), follower.id
13
14
  Socialization.redis.sadd generate_followables_key(follower, followable), followable.id
14
15
 
15
- call_after_create_hook(follower, followable)
16
- follower.touch if [:all, :follower].include?(touch) && follower.respond_to?(:touch)
17
- followable.touch if [:all, :followable].include?(touch) && followable.respond_to?(:touch)
16
+ call_after_create_hooks(follower, followable)
18
17
  true
19
18
  else
20
19
  false
@@ -26,9 +25,7 @@ module Socialization
26
25
  Socialization.redis.srem generate_followers_key(follower, followable), follower.id
27
26
  Socialization.redis.srem generate_followables_key(follower, followable), followable.id
28
27
 
29
- call_after_destroy_hook(follower, followable)
30
- follower.touch if [:all, :follower].include?(touch) && follower.respond_to?(:touch)
31
- followable.touch if [:all, :followable].include?(touch) && followable.respond_to?(:touch)
28
+ call_after_destroy_hooks(follower, followable)
32
29
  true
33
30
  else
34
31
  false
@@ -73,34 +70,7 @@ module Socialization
73
70
  end
74
71
  end
75
72
 
76
- def touch(what = nil)
77
- if what.nil?
78
- @touch || false
79
- else
80
- raise ArgumentError unless [:all, :follower, :followable, false, nil].include?(what)
81
- @touch = what
82
- end
83
- end
84
-
85
- def after_follow(method)
86
- raise ArgumentError unless method.is_a?(Symbol) || method.nil?
87
- @after_create_hook = method
88
- end
89
-
90
- def after_unfollow(method)
91
- raise ArgumentError unless method.is_a?(Symbol) || method.nil?
92
- @after_destroy_hook = method
93
- end
94
-
95
73
  private
96
- def call_after_create_hook(follower, followable)
97
- self.send(@after_create_hook, follower, followable) if @after_create_hook
98
- end
99
-
100
- def call_after_destroy_hook(follower, followable)
101
- self.send(@after_destroy_hook, follower, followable) if @after_destroy_hook
102
- end
103
-
104
74
  def generate_followers_key(follower, followable)
105
75
  raise ArgumentError.new("`followable` needs to be an acts_as_followable objecs, not a class.") if followable.class == Class
106
76
  follower_class = if follower.class == Class
@@ -3,8 +3,9 @@
3
3
  module Socialization
4
4
  module RedisStores
5
5
  class Like < Socialization::RedisStores::Base
6
- include Socialization::RedisStores::Mixins::Base
7
- include Socialization::Stores::Mixins::Follow
6
+ extend Socialization::Stores::Mixins::Base
7
+ extend Socialization::Stores::Mixins::Like
8
+ extend Socialization::RedisStores::Mixins::Base
8
9
 
9
10
  class << self
10
11
  def like!(liker, likeable)
@@ -12,7 +13,7 @@ module Socialization
12
13
  Socialization.redis.sadd generate_likers_key(liker, likeable), liker.id
13
14
  Socialization.redis.sadd generate_likeables_key(liker, likeable), likeable.id
14
15
 
15
- call_after_create_hook(liker, likeable)
16
+ call_after_create_hooks(liker, likeable)
16
17
  liker.touch if [:all, :liker].include?(touch) && liker.respond_to?(:touch)
17
18
  likeable.touch if [:all, :likeable].include?(touch) && likeable.respond_to?(:touch)
18
19
  true
@@ -26,7 +27,7 @@ module Socialization
26
27
  Socialization.redis.srem generate_likers_key(liker, likeable), liker.id
27
28
  Socialization.redis.srem generate_likeables_key(liker, likeable), likeable.id
28
29
 
29
- call_after_destroy_hook(liker, likeable)
30
+ call_after_destroy_hooks(liker, likeable)
30
31
  liker.touch if [:all, :liker].include?(touch) && liker.respond_to?(:touch)
31
32
  likeable.touch if [:all, :likeable].include?(touch) && likeable.respond_to?(:touch)
32
33
  true
@@ -93,11 +94,11 @@ module Socialization
93
94
  end
94
95
 
95
96
  private
96
- def call_after_create_hook(liker, likeable)
97
+ def call_after_create_hooks(liker, likeable)
97
98
  self.send(@after_create_hook, liker, likeable) if @after_create_hook
98
99
  end
99
100
 
100
- def call_after_destroy_hook(liker, likeable)
101
+ def call_after_destroy_hooks(liker, likeable)
101
102
  self.send(@after_destroy_hook, liker, likeable) if @after_destroy_hook
102
103
  end
103
104
 
@@ -3,8 +3,9 @@
3
3
  module Socialization
4
4
  module RedisStores
5
5
  class Mention < Socialization::RedisStores::Base
6
- include Socialization::RedisStores::Mixins::Base
7
- include Socialization::Stores::Mixins::Mention
6
+ extend Socialization::Stores::Mixins::Base
7
+ extend Socialization::Stores::Mixins::Mention
8
+ extend Socialization::RedisStores::Mixins::Base
8
9
 
9
10
  class << self
10
11
  def mention!(mentioner, mentionable)
@@ -12,9 +13,7 @@ module Socialization
12
13
  Socialization.redis.sadd generate_mentioners_key(mentioner, mentionable), mentioner.id
13
14
  Socialization.redis.sadd generate_mentionables_key(mentioner, mentionable), mentionable.id
14
15
 
15
- call_after_create_hook(mentioner, mentionable)
16
- mentioner.touch if [:all, :mentioner].include?(touch) && mentioner.respond_to?(:touch)
17
- mentionable.touch if [:all, :mentionable].include?(touch) && mentionable.respond_to?(:touch)
16
+ call_after_create_hooks(mentioner, mentionable)
18
17
  true
19
18
  else
20
19
  false
@@ -26,9 +25,7 @@ module Socialization
26
25
  Socialization.redis.srem generate_mentioners_key(mentioner, mentionable), mentioner.id
27
26
  Socialization.redis.srem generate_mentionables_key(mentioner, mentionable), mentionable.id
28
27
 
29
- call_after_destroy_hook(mentioner, mentionable)
30
- mentioner.touch if [:all, :mentioner].include?(touch) && mentioner.respond_to?(:touch)
31
- mentionable.touch if [:all, :mentionable].include?(touch) && mentionable.respond_to?(:touch)
28
+ call_after_destroy_hooks(mentioner, mentionable)
32
29
  true
33
30
  else
34
31
  false
@@ -73,34 +70,7 @@ module Socialization
73
70
  end
74
71
  end
75
72
 
76
- def touch(what = nil)
77
- if what.nil?
78
- @touch || false
79
- else
80
- raise ArgumentError unless [:all, :mentioner, :mentionable, false, nil].include?(what)
81
- @touch = what
82
- end
83
- end
84
-
85
- def after_mention(method)
86
- raise ArgumentError unless method.is_a?(Symbol) || method.nil?
87
- @after_create_hook = method
88
- end
89
-
90
- def after_unmention(method)
91
- raise ArgumentError unless method.is_a?(Symbol) || method.nil?
92
- @after_destroy_hook = method
93
- end
94
-
95
73
  private
96
- def call_after_create_hook(mentioner, mentionable)
97
- self.send(@after_create_hook, mentioner, mentionable) if @after_create_hook
98
- end
99
-
100
- def call_after_destroy_hook(mentioner, mentionable)
101
- self.send(@after_destroy_hook, mentioner, mentionable) if @after_destroy_hook
102
- end
103
-
104
74
  def generate_mentioners_key(mentioner, mentionable)
105
75
  raise ArgumentError.new("`mentionable` needs to be an acts_as_mentionable objecs, not a class.") if mentionable.class == Class
106
76
  mentioner_class = if mentioner.class == Class
@@ -1,3 +1,3 @@
1
1
  module Socialization
2
- VERSION = "0.5.0.beta2"
2
+ VERSION = "0.5.0.beta3"
3
3
  end
@@ -3,6 +3,7 @@ module ActiveRecord
3
3
  def is_followable?
4
4
  false
5
5
  end
6
+ alias followable? is_followable?
6
7
  end
7
8
  end
8
9
 
@@ -17,6 +18,7 @@ module Socialization
17
18
  def is_followable?
18
19
  true
19
20
  end
21
+ alias followable? is_followable?
20
22
 
21
23
  # Specifies if self is followed by a {Follower} object.
22
24
  #
@@ -3,6 +3,7 @@ module ActiveRecord
3
3
  def is_likeable?
4
4
  false
5
5
  end
6
+ alias likeable? is_likeable?
6
7
  end
7
8
  end
8
9
 
@@ -17,6 +18,7 @@ module Socialization
17
18
  def is_likeable?
18
19
  true
19
20
  end
21
+ alias likeable? is_likeable?
20
22
 
21
23
  # Specifies if self is liked by a {Liker} object.
22
24
  #
@@ -3,6 +3,7 @@ module ActiveRecord
3
3
  def is_mentionable?
4
4
  false
5
5
  end
6
+ alias mentionable? is_mentionable?
6
7
  end
7
8
  end
8
9
 
@@ -17,6 +18,7 @@ module Socialization
17
18
  def is_mentionable?
18
19
  true
19
20
  end
21
+ alias mentionable? is_mentionable?
20
22
 
21
23
  # Specifies if self is mentioned by a {Mentioner} object.
22
24
  #
@@ -7,12 +7,18 @@ class FollowerTest < Test::Unit::TestCase
7
7
  @followable = ImAFollowable.create
8
8
  end
9
9
 
10
- context "#is_follower" do
10
+ context "#is_follower?" do
11
11
  should "return true" do
12
12
  assert_true @follower.is_follower?
13
13
  end
14
14
  end
15
15
 
16
+ context "#follower?" do
17
+ should "return true" do
18
+ assert_true @follower.follower?
19
+ end
20
+ end
21
+
16
22
  context "#follow!" do
17
23
  should "not accept non-followables" do
18
24
  assert_raise(ArgumentError) { @follower.follow!(:foo) }
@@ -7,12 +7,18 @@ class LikerTest < Test::Unit::TestCase
7
7
  @likeable = ImALikeable.create
8
8
  end
9
9
 
10
- context "#is_liker" do
10
+ context "#is_liker?" do
11
11
  should "return true" do
12
12
  assert_true @liker.is_liker?
13
13
  end
14
14
  end
15
15
 
16
+ context "#liker?" do
17
+ should "return true" do
18
+ assert_true @liker.liker?
19
+ end
20
+ end
21
+
16
22
  context "#like!" do
17
23
  should "not accept non-likeables" do
18
24
  assert_raise(ArgumentError) { @liker.like!(:foo) }
@@ -7,12 +7,18 @@ class MentionerTest < Test::Unit::TestCase
7
7
  @mentionable = ImAMentionable.create
8
8
  end
9
9
 
10
- context "#is_mentioner" do
10
+ context "#is_mentioner?" do
11
11
  should "return true" do
12
12
  assert_true @mentioner.is_mentioner?
13
13
  end
14
14
  end
15
15
 
16
+ context "#mentioner?" do
17
+ should "return true" do
18
+ assert_true @mentioner.mentioner?
19
+ end
20
+ end
21
+
16
22
  context "#mention!" do
17
23
  should "not accept non-mentionables" do
18
24
  assert_raise(ArgumentError) { @mentioner.mention!(:foo) }
@@ -7,12 +7,18 @@ class FollowableTest < Test::Unit::TestCase
7
7
  @followable = ImAFollowable.create
8
8
  end
9
9
 
10
- context "#is_followable" do
10
+ context "#is_followable?" do
11
11
  should "return true" do
12
12
  assert_true @followable.is_followable?
13
13
  end
14
14
  end
15
15
 
16
+ context "#followable?" do
17
+ should "return true" do
18
+ assert_true @followable.followable?
19
+ end
20
+ end
21
+
16
22
  context "#followed_by?" do
17
23
  should "not accept non-followers" do
18
24
  assert_raise(ArgumentError) { @followable.followed_by?(:foo) }
@@ -7,12 +7,18 @@ class LikeableTest < Test::Unit::TestCase
7
7
  @likeable = ImALikeable.create
8
8
  end
9
9
 
10
- context "#is_likeable" do
10
+ context "#is_likeable?" do
11
11
  should "return true" do
12
12
  assert_true @likeable.is_likeable?
13
13
  end
14
14
  end
15
15
 
16
+ context "#likeable?" do
17
+ should "return true" do
18
+ assert_true @likeable.likeable?
19
+ end
20
+ end
21
+
16
22
  context "#liked_by?" do
17
23
  should "not accept non-likers" do
18
24
  assert_raise(ArgumentError) { @likeable.liked_by?(:foo) }
@@ -7,12 +7,18 @@ class MentionableTest < Test::Unit::TestCase
7
7
  @mentionable = ImAMentionable.create
8
8
  end
9
9
 
10
- context "#is_mentionable" do
10
+ context "#is_mentionable?" do
11
11
  should "return true" do
12
12
  assert_true @mentionable.is_mentionable?
13
13
  end
14
14
  end
15
15
 
16
+ context "#mentionable?" do
17
+ should "return true" do
18
+ assert_true @mentionable.mentionable?
19
+ end
20
+ end
21
+
16
22
  context "#mentioned_by?" do
17
23
  should "not accept non-mentioners" do
18
24
  assert_raise(ArgumentError) { @mentionable.mentioned_by?(:foo) }
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialization
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1564876628
4
+ hash: 699693383
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
9
  - 0
10
10
  - beta
11
- - 2
12
- version: 0.5.0.beta2
11
+ - 3
12
+ version: 0.5.0.beta3
13
13
  platform: ruby
14
14
  authors:
15
15
  - Carl Mercier
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-06-08 00:00:00 -04:00
20
+ date: 2012-07-05 00:00:00 -04:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency