Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pq-wsm

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pq-wsm

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

PcQueues

A Queue Management Gem with Redis backing.

Copyright (c) ProctorCam Inc. 2014 All rights reserved

Installation

Dependency: Rails, Database, PubNub

Add the following to your Gemfile

gem 'pc-queues', :git => 'git@gitlab.proctorcam.com:proctorcam-development/pc-queues', :branch => 'develop'

Run the install and migration generators

> rails g pc_queues:install
> rails g pc_queues:migration
> rake db:migrate

Update the initializer in config/initializers/pc_queues.rb to initialize the PubNub instance used.

That's it - you're done setting up.

Getting Started

Once you've got the gem setup. You'll designate Models as Enqueable and as Queue owners. Classes that are Enqueueable can be enqueued and dequeued from a Queue Classes that are Queue owners can have has_one and has_many relationships to Queues.

Queues are setup for single table inheritance, so you can derive from Queue to handle Class specific behavior.

An ActiveRecordClass can be both a Queue owner and Enqueable.

Setting Up to be a Queue Owner
require 'pc_queues'

class MyQueue < PcQueues::Queue
end

class MyModel < ActiveRecord::Base
  include ACTS_AS_QUEUE_OWNER
  
  has_many_queues_as :my_queues
  has_one_queue_as :fast_stuff, class_name: 'MyQueue'
end
Setting Up to be a Queue Item
require 'pc_queues'

class MyModel < ActiveRecord::Base
  include ACTS_AS_ENQUEABLE

end
Queue Manipulation
model = MyModel.create attr1: value1

# has_one
model.create_fast_stuff attr1: value1

# has_many
model.my_queues.create attr1: value1

# Enqueue/Dequeue
model.fast_stuff.enqueue my_acts_as_enqueuable_object

my_acts_as_enqueuable_object = model.fast_stuff.dequeue


# Queue Length
length = model.fast_stuff.length

FAQs

Package last updated on 08 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc