Module: Commontator::Config::ClassMethods

Defined in:
lib/commontator/config.rb

Instance Method Summary collapse

Instance Method Details

#comment_url(comment, routing_proxy) ⇒ Object



141
142
143
# File 'lib/commontator/config.rb', line 141

def comment_url(comment, routing_proxy)
  commontable_config(comment.thread.commontable).comment_url_proc.call(comment, routing_proxy)
end

#commontable_config(obj) ⇒ Object



113
114
115
# File 'lib/commontator/config.rb', line 113

def commontable_config(obj)
  (obj && obj.is_commontable) ? obj.commontable_config : self
end

#commontable_name(commontable) ⇒ Object



137
138
139
# File 'lib/commontator/config.rb', line 137

def commontable_name(commontable)
  commontable_config(commontable).commontable_name_proc.call(commontable)
end

#commontator_avatar(user, view) ⇒ Object



129
130
131
# File 'lib/commontator/config.rb', line 129

def commontator_avatar(user, view)
  commontator_config(user).user_avatar_proc.call(user, view)
end

#commontator_config(user) ⇒ Object



109
110
111
# File 'lib/commontator/config.rb', line 109

def commontator_config(user)
  (user && user.is_commontator) ? user.commontator_config : self
end

#commontator_email(user, mailer = nil) ⇒ Object



125
126
127
# File 'lib/commontator/config.rb', line 125

def commontator_email(user, mailer = nil)
  commontator_config(user).user_email_proc.call(user, mailer)
end


121
122
123
# File 'lib/commontator/config.rb', line 121

def commontator_link(user, routing_proxy)
  commontator_config(user).user_link_proc.call(user, routing_proxy)
end

#commontator_mentions(user, thread, search_phrase) ⇒ Object



133
134
135
# File 'lib/commontator/config.rb', line 133

def commontator_mentions(user, thread, search_phrase)
  commontator_config(user).user_mentions_proc.call(user, thread, search_phrase)
end

#commontator_name(user) ⇒ Object



117
118
119
# File 'lib/commontator/config.rb', line 117

def commontator_name(user)
  commontator_config(user).user_name_proc.call(user)
end

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



101
102
103
104
105
106
107
# File 'lib/commontator/config.rb', line 101

def configure
  self.show_deprecation_warning = false

  yield self

  warn("\n[COMMONTATOR] We recommend that you backup the config/initializers/commontator.rb file, rename or remove it, run rake commontator:install:initializers to copy the new default one, then configure it to your liking.\n") if show_deprecation_warning
end