Class: Carpool::Passenger
- Inherits:
-
Object
- Object
- Carpool::Passenger
- Includes:
- Mixins::Core
- Defined in:
- lib/carpool/passenger.rb
Class Attribute Summary collapse
-
.driver_uri ⇒ Object
Returns the value of attribute driver_uri.
-
.secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) {|Carpool::Passenger| ... } ⇒ Passenger
constructor
A new instance of Passenger.
Methods included from Mixins::Core
Constructor Details
#initialize(app) {|Carpool::Passenger| ... } ⇒ Passenger
Returns a new instance of Passenger.
13 14 15 16 17 18 |
# File 'lib/carpool/passenger.rb', line 13 def initialize(app) @app = app Carpool.acts_as = :passenger yield Carpool::Passenger if block_given? self end |
Class Attribute Details
.driver_uri ⇒ Object
Returns the value of attribute driver_uri.
8 9 10 |
# File 'lib/carpool/passenger.rb', line 8 def driver_uri @driver_uri end |
.secret ⇒ Object
Returns the value of attribute secret.
9 10 11 |
# File 'lib/carpool/passenger.rb', line 9 def secret @secret end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/carpool/passenger.rb', line 20 def call(env) @env = env env['carpool'] = Carpool::Seatbelt.new(env) unless env['carpool'] && env['carpool'] != Carpool::Seatbelt return @app.call(env) unless valid_request? result = catch(:carpool) do @app.call(env) end return result end |