party_boy 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +1 -1
  2. data/VERSION +1 -1
  3. data/lib/party_boy.rb +21 -18
  4. data/party_boy.gemspec +2 -2
  5. metadata +3 -3
data/README.rdoc CHANGED
@@ -63,7 +63,7 @@ STI is also handled by party_boy. The relationship is always stored using the su
63
63
  In string form
64
64
  a.followers('users')
65
65
  => [#<User id: 1, created_at: "2010-01-27 01:09:42", updated_at: "2010-01-27 01:09:42">]
66
- a.following(quarterbacks)
66
+ a.following('quarterbacks')
67
67
  => [#<Quarterback id: 3, created_at: "2010-01-27 01:09:42", updated_at: "2010-01-27 01:09:42">]
68
68
  Or in class form
69
69
  a.followers(User)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.3.0
data/lib/party_boy.rb CHANGED
@@ -63,6 +63,13 @@ module Party
63
63
 
64
64
  module FollowableInstanceMethods
65
65
 
66
+ def self.included(base)
67
+ base.class_eval do
68
+ alias_method_chain :method_missing, :party_boy
69
+ alias_method_chain :respond_to?, :party_boy
70
+ end
71
+ end
72
+
66
73
  def following?(something)
67
74
  !!(something && Relationship.unblocked.count(:conditions => ['requestor_id = ? and requestor_type = ? and requestee_id = ? and requestee_type = ?', self.id, super_class_name, something.id, super_class_name(something)]) > 0)
68
75
  end
@@ -130,9 +137,9 @@ module Party
130
137
  network(type).collect{|friend| friend.methods.include?('network') && friend.network(type) || []}.flatten.uniq
131
138
  end
132
139
 
133
- def method_missing(method, *args)
140
+ def method_missing_with_party_boy(method, *args)
134
141
  includes = args[0] || {}
135
- case method.id2name
142
+ case method.to_s
136
143
  when /^(.+)ss_followers$/
137
144
  followers("#{$1}ss".classify, includes)
138
145
  when /^(.+)s_followers$/, /^(.+)_followers$/
@@ -140,25 +147,21 @@ module Party
140
147
  when /^following_(.+)$/
141
148
  following($1.classify, includes)
142
149
  else
143
- super
150
+ self.method_missing_without_party_boy(method, *args)
144
151
  end
145
152
  end
146
153
 
147
- def respond_to?(name, include_private = false)
148
- if !super(name, include_private)
149
- case name
150
- when /^(.+)ss_followers$/
151
- true
152
- when /^(.+)s_followers$/, /^(.+)_followers$/
153
- true
154
- when /^following_(.+)$/
155
- true
156
- else
157
- false
158
- end
159
- else
160
- true
161
- end
154
+ def respond_to_with_party_boy?(name, include_private = false)
155
+ case name.to_s
156
+ when /^(.+)ss_followers$/
157
+ true
158
+ when /^(.+)s_followers$/, /^(.+)_followers$/
159
+ true
160
+ when /^following_(.+)$/
161
+ true
162
+ else
163
+ self.respond_to_without_party_boy?(name, include_private)
164
+ end
162
165
  end
163
166
 
164
167
  private
data/party_boy.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{party_boy}
8
- s.version = "0.2.3"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mike Nelson"]
12
- s.date = %q{2010-05-04}
12
+ s.date = %q{2010-08-17}
13
13
  s.description = %q{Models relationships between AR models. Allows you to follow, friend, and block other AR's. Consists of two mixins: acts_as_followable and acts_as_friend. These options allow an AR to inherit either a twitter-like follower system or a facebook-like friend system.}
14
14
  s.email = %q{mdnelson30@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
7
  - 3
9
- version: 0.2.3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mike Nelson
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-04 00:00:00 -04:00
17
+ date: 2010-08-17 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency