Module: Rfaye::ViewHelpers
- Included in:
- ActionController::Base
- Defined in:
- lib/rfaye/view_helpers.rb
Instance Method Summary collapse
Instance Method Details
#pub(channel, data = nil, &block) ⇒ Object
24 25 26 |
# File 'lib/rfaye/view_helpers.rb', line 24 def pub channel, data = nil, &block Net::HTTP.post_form(uri, message: (channel, data || data(&block))) end |
#sub(channel, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rfaye/view_helpers.rb', line 6 def sub channel, &block channel = "/#{channel}" if !channel.start_with?("/") content_tag "script", :type => "text/javascript" do if block raw %[Rfaye.sub("#{channel}",function(data){#{capture(&block)}})] else raw %[Rfaye.sub("#{channel}")] end end end |
#un_sub(channel) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/rfaye/view_helpers.rb', line 17 def un_sub channel channel = "/#{channel}" if !channel.start_with?("/") content_tag "script", :type => "text/javascript" do raw %[Rfaye.un_sub("#{channel}")] end end |