Sha256: d2ffb08592396e257e836106c15e0b70f1e332bfc42b7235a97dadfb7b626776

Contents?: true

Size: 454 Bytes

Versions: 1

Compression:

Stored size: 454 Bytes

Contents

module PrivatePub
  module ViewHelpers
    def publish_to(channel, data = nil, &block)
      PrivatePub.publish_to(channel, data || capture(&block))
    end

    def subscribe_to(channel)
      subscription = PrivatePub.subscription(:channel => channel)
      subscription[:server] = PrivatePub.config[:server]
      content_tag "script", :type => "text/javascript" do
        raw("PrivatePub.sign(#{subscription.to_json});")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
private_pub-0.3.0 lib/private_pub/view_helpers.rb