4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/disqus_rails/active_record/acts_as_disquser.rb', line 4
def (attributes={})
define_method :disqus_params do
data = {}
if attributes.has_key?(:id)
if attributes[:id].is_a? Proc
data[:id] = instance_eval &attributes[:id]
else
data[:id] = send attributes[:id]
end
else
data[:id] = self.id
end
if attributes.has_key?(:username)
if attributes[:username].is_a? Proc
data[:username] = instance_eval &attributes[:username]
else
data[:username] = send attributes[:username]
end
end
if attributes.has_key?(:email)
if attributes[:email].is_a? Proc
data[:email] = instance_eval &attributes[:email]
else
data[:email] = send attributes[:email]
end
end
if attributes.has_key?(:avatar)
if attributes[:avatar].is_a? Proc
data[:avatar] = instance_eval &attributes[:avatar]
else
data[:avatar] = send attributes[:avatar]
end
end
data
end
end
|