Skip to content

Instantly share code, notes, and snippets.

@fred
Created September 4, 2013 06:47
Show Gist options
  • Save fred/6433475 to your computer and use it in GitHub Desktop.
Save fred/6433475 to your computer and use it in GitHub Desktop.
publishing keen.io with celluloid
# lib/models/keen_publisher.rb
require 'celluloid'
class KeenPublisher
include Celluloid
def initialize(name, status)
@name = name
@status = status
end
def publish
Keen.publish(@name, @status)
end
end
# from anywhere else
user = User.first
KeenPublisher.new(:new_user, user.keen_data).async.publish
# instead of default way
Keen.publish(:new_user, user.keen_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment