The idea here is that the handler can create a class, implementing any to_adapter methods it can support, and lita would call the adapter correspondent method. If the adapter isn't supported, a fallback to_s method must exist. Here is a sample class that the handler could create:
class Message
def initialize(message)
@message = message
end
def to_slack
@message
end
def to_s
@message[:text]
end
end
I put this approach in discussion at https://github.com/kenjij/lita-slack/issues/30.
The idea here is that the handler can create a class, implementing any
to_adapter
methods it can support, and lita would call the adapter correspondent method. If the adapter isn't supported, a fallback to_s method must exist. Here is a sample class that the handler could create: