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