Class: BallotBox::Manager
- Inherits:
-
Object
- Object
- BallotBox::Manager
- Extended by:
- Callbacks
- Defined in:
- lib/ballot_box/manager.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#_run_callbacks(*args) ⇒ Object
:api: private.
-
#call(env) ⇒ Object
:nodoc:.
-
#initialize(app, options = {}) {|@config| ... } ⇒ Manager
constructor
Initialize the middleware.
Methods included from Callbacks
_after_vote, _before_vote, after_vote, before_vote
Constructor Details
#initialize(app, options = {}) {|@config| ... } ⇒ Manager
Initialize the middleware. If a block is given, a BallotBox::Config is yielded so you can properly configure the BallotBox::Manager.
10 11 12 13 14 15 16 |
# File 'lib/ballot_box/manager.rb', line 10 def initialize(app, ={}) .symbolize_keys! @app, @config = app, BallotBox::Config.new() yield @config if block_given? self end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/ballot_box/manager.rb', line 6 def config @config end |
Instance Method Details
#_run_callbacks(*args) ⇒ Object
:api: private
27 28 29 |
# File 'lib/ballot_box/manager.rb', line 27 def _run_callbacks(*args) #:nodoc: self.class._run_callbacks(*args) end |
#call(env) ⇒ Object
:nodoc:
18 19 20 21 22 23 24 |
# File 'lib/ballot_box/manager.rb', line 18 def call(env) # :nodoc: if voting_path?(env['PATH_INFO']) && env["REQUEST_METHOD"] == "POST" create(env) else @app.call(env) end end |