Permalink
Browse files

Use class_attribute for setting transport

  • Loading branch information...
lifo committed Feb 18, 2011
1 parent f460106 commit 3868221f996a3793eab163a10a3fefa212d810fc
Showing with 5 additions and 16 deletions.
  1. +3 −0 lib/cramp/abstract.rb
  2. +0 −4 lib/cramp/action.rb
  3. +1 −6 lib/cramp/long_polling.rb
  4. +1 −6 lib/cramp/sse.rb
View
@@ -4,6 +4,9 @@ module Cramp
class Abstract
include Callbacks
+ class_attribute :transport
+ self.transport = :regular
+
class << self
def call(env)
controller = new(env).process
View
@@ -27,10 +27,6 @@ def respond_with
end
end
- def transport
- :regular
- end
-
def render_regular(body, *)
@body.call(body)
end
@@ -1,11 +1,6 @@
module Cramp
# All the usual Cramp::Action stuff. But the request is terminated as soon as render() is called.
class LongPolling < Action
- protected
-
- def transport
- :long_polling
- end
-
+ self.transport = :long_polling
end
end
View
@@ -1,10 +1,5 @@
module Cramp
class SSE < Action
- protected
-
- def transport
- :sse
- end
-
+ self.transport = :sse
end
end

0 comments on commit 3868221

Please sign in to comment.