Sha256: 8db31334341829d2d51c322fe09954b464874dd34a06412c5821ceadc982c8eb
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
module Alondra class PushController include ActiveSupport::Configurable include AbstractController::Logger include AbstractController::Rendering include AbstractController::Helpers include AbstractController::Translation include AbstractController::AssetPaths helper_method :protect_against_forgery? attr_accessor :channel_names attr_accessor :request def initialize(context, to, request = nil) @channel_names = Channel.names_for(to) @request = request self.class.view_paths = ActionController::Base.view_paths copy_instance_variables_from(context) end def render_push(options) if EM.reactor_thread? Log.warn 'You are rendering a view from the Event Machine reactor thread' Log.warn 'Rendering a view is a possibly blocking operation, so be careful' end message_content = render_to_string(*options) msg = Message.new(message_content, channel_names) msg.enqueue end def _prefixes ['application'] end def view_paths @view_paths ||= ApplicationController.send '_view_paths' end def action_name 'push' end def protect_against_forgery? false end def self.protect_against_forgery? false end private def copy_instance_variables_from(context) context.instance_variables.each do |var| value = context.instance_variable_get(var) instance_variable_set(var, value) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alondra-0.1.1 | lib/alondra/push_controller.rb |
alondra-0.1.0 | lib/alondra/push_controller.rb |