Sha256: 902034254b725e476619efd3be04ec4d1a6d9d1f3f760781ab2df48357d12c57

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

require "nerve"
require "nerve/easy"

module Doorkeepr
  module Rails
    class Nerve
      attr_accessor :nerve, :thread
      def initialize
        return unless Doorkeepr.config.to_h[:entrance]
        Rails.announce Entrance.new.service
      end
      def publish
        return unless Doorkeepr.config.to_h[:entrance]
        ::Rails.logger.debug "publish service"
        @nerve = ::Nerve::Nerve.new Rails.config.to_nerve
        @thread = Thread.new do
          nerve.run
        end
      end
      def depublish
        return unless thread
        ::Rails.logger.debug "depublish service"
        thread.kill
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
doorkeepr-rails-0.1.6 lib/doorkeepr/rails/nerve.rb