lib/phenomenal_rails/middleware.rb in phenomenal_rails-1.1.0 vs lib/phenomenal_rails/middleware.rb in phenomenal_rails-1.2.2
- old
+ new
@@ -1,27 +1,25 @@
-module PhenomenalRails
- class Middleware
- def initialize(app)
- @app=app
- @activation_conditions=Array.new
- Phenomenal::Feature.middleware=self
- end
-
- def add_condition(feature,&block)
- @activation_conditions.push([feature,block])
- end
+class PhenomenalRails::Middleware
+ def initialize(app)
+ @app=app
+ @activation_conditions=Array.new
+ Phenomenal::Feature.middleware=self
+ end
+
+ def add_condition(feature,&block)
+ @activation_conditions.push([feature,block])
+ end
- def call(env)
- before_call(env)
- @app.call(env)
- end
-
- def before_call(env)
- @activation_conditions.each do |feature_block|
- feature,block = feature_block
- if feature.active?
- block.call(env)
- end
+ def call(env)
+ before_call(env)
+ @app.call(env)
+ end
+
+ def before_call(env)
+ @activation_conditions.each do |feature_block|
+ feature,block = feature_block
+ if feature.active?
+ block.call(env)
end
end
end
end