party_boy 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/party_boy.rb +22 -32
  3. data/party_boy.gemspec +2 -2
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
data/lib/party_boy.rb CHANGED
@@ -63,13 +63,6 @@ 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
-
73
66
  def following?(something)
74
67
  !!(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)
75
68
  end
@@ -137,31 +130,28 @@ module Party
137
130
  network(type).collect{|friend| friend.methods.include?('network') && friend.network(type) || []}.flatten.uniq
138
131
  end
139
132
 
140
- def method_missing_with_party_boy(method, *args)
141
- includes = args[0] || {}
142
- case method.to_s
143
- when /^(.+)ss_followers$/
144
- followers("#{$1}ss".classify, includes)
145
- when /^(.+)s_followers$/, /^(.+)_followers$/
146
- followers($1.classify, includes)
147
- when /^following_(.+)$/
148
- following($1.classify, includes)
149
- else
150
- self.method_missing_without_party_boy(method, *args)
151
- end
152
- end
153
-
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
133
+ def method_missing(method, *args)
134
+ begin
135
+ super
136
+ rescue NoMethodError, NameError => e
137
+ includes = args[0] || {}
138
+ case method.to_s
139
+ when /^(.+)ss_followers$/
140
+ followers("#{$1}ss".classify, includes)
141
+ when /^(.+)s_followers$/, /^(.+)_followers$/
142
+ followers($1.classify, includes)
143
+ when /^following_(.+)$/
144
+ following($1.classify, includes)
145
+ else
146
+ raise e
147
+ end
148
+ end
149
+ end
150
+
151
+ def respond_to?(name, include_private = false)
152
+ return true if super
153
+ [/^(.+)ss_followers$/, /^(.+)s_followers$/, /^(.+)_followers$/, /^following_(.+)$/].each{|reg| return true if name.to_s =~ reg}
154
+ false
165
155
  end
166
156
 
167
157
  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.3.0"
8
+ s.version = "0.3.1"
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-08-17}
12
+ s.date = %q{2010-08-29}
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
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 0
9
- version: 0.3.0
8
+ - 1
9
+ version: 0.3.1
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-08-17 00:00:00 -04:00
17
+ date: 2010-08-29 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency