Sha256: ab840febf7ef7cf8ca885fa932466301a384fbac0ba4daff1015e45b5e845c06
Contents?: true
Size: 736 Bytes
Versions: 20
Compression:
Stored size: 736 Bytes
Contents
module Husky module Ears def listen_to(object, listeners = []) klass = "#{controller_name.camelize}Responder".constantize default = klass.new(self) listeners << default listeners.each do |listener| object.add_listener(listener) end end def interact(interactor) listen_to(interactor) interactor.run end def deliver_entities(entities, *options) serve_for(entities.map(&:object), *options) end def deliver_entity(entity, *options) serve_for(entity.object, *options) end private def serve_for(target, *options) args = { json: target } options.each { |option| args.merge!(option) } render(args) end end end
Version data entries
20 entries across 20 versions & 1 rubygems