Module: Replyr::HandleReply::ClassMethods
- Defined in:
- lib/replyr/handle_reply.rb
Instance Method Summary collapse
-
#handle_reply(*options, &block) ⇒ Object
Usage: class Comment < ActiveRecord::Base handle_reply do |comment, user, text, files| Comment.create(body: text, author: user) end end.
Instance Method Details
#handle_reply(*options, &block) ⇒ Object
Usage: class Comment < ActiveRecord::Base
handle_reply do |comment, user, text, files|
Comment.create(body: text, author: user)
end
end
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/replyr/handle_reply.rb', line 17 def handle_reply(*, &block) = . define_method :handle_reply do |user, text, files = nil| block.call(self, user, text, files) end define_method :reply_address_object_for_user do |user| ReplyAddress.new(self, user) end define_method :reply_address_for_user do |user| reply_address_object_for_user(user).to_s end end |