Skip to content

Instantly share code, notes, and snippets.

@mrpunkin
Created March 8, 2014 03:54
Show Gist options
  • Select an option

  • Save mrpunkin/9425072 to your computer and use it in GitHub Desktop.

Select an option

Save mrpunkin/9425072 to your computer and use it in GitHub Desktop.
FooJob = ShopifyJob.new(:shop_id) do
def perform
## code I want wrapped in superclass' session call ##
end
end
class ShopifyJob < Struct
attr_accessor :shop
def perform
shop.session do
sleep ShopifyAPI.credit_used
yield
end
end
def before(job)
self.shop = Shop.find(shop_id)
yield
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment