Class: OmniGroupContacts::Builder
- Inherits:
-
Rack::Builder
- Object
- Rack::Builder
- OmniGroupContacts::Builder
- Defined in:
- lib/omnigroupcontacts/builder.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
- #importer(importer, *args) ⇒ Object
-
#initialize(app, &block) ⇒ Builder
constructor
A new instance of Builder.
- #rack14? ⇒ Boolean
Constructor Details
#initialize(app, &block) ⇒ Builder
Returns a new instance of Builder.
5 6 7 8 9 10 11 12 |
# File 'lib/omnigroupcontacts/builder.rb', line 5 def initialize(app, &block) if rack14? super else @app = app super(&block) end end |
Instance Method Details
#call(env) ⇒ Object
25 26 27 28 |
# File 'lib/omnigroupcontacts/builder.rb', line 25 def call env @ins << @app unless rack14? || @ins.include?(@app) to_app.call(env) end |
#importer(importer, *args) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/omnigroupcontacts/builder.rb', line 18 def importer importer, *args middleware = OmniGroupContacts::Importer.const_get(importer.to_s.capitalize) use middleware, *args rescue NameError raise LoadError, "Could not find importer #{importer}." end |
#rack14? ⇒ Boolean
14 15 16 |
# File 'lib/omnigroupcontacts/builder.rb', line 14 def rack14? Rack.release.split('.')[1].to_i >= 4 end |