Class: Wedge::Middleware
Defined Under Namespace
Classes: Responder
Class Attribute Summary collapse
-
.scope ⇒ Object
Returns the value of attribute scope.
-
.skip_call ⇒ Object
Returns the value of attribute skip_call.
Instance Attribute Summary collapse
-
#skip_call ⇒ Object
readonly
Returns the value of attribute skip_call.
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app = false, settings = false) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app = false, settings = false) ⇒ Middleware
Returns a new instance of Middleware.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/wedge/middleware.rb', line 5 def initialize(app = false, settings = false) if settings case settings when Proc Wedge.config.instance_eval &settings else settings.each { |k, v| Wedge.config.send "#{k}=", v } end @opal = { server: Wedge::Opal::Server.new { |s| s.prefix = Wedge.config.assets_url s.debug = Wedge.config.debug s.append_path "#{Dir.pwd}/#{Wedge.config.app_dir}" }} if Wedge.config.debug @opal[:sprockets] = @opal[:server].sprockets @opal[:maps_prefix] = "#{Wedge.config.assets_url}/__OPAL_SOURCE_MAPS__" @opal[:maps_app] = Opal::SourceMapServer.new @opal[:sprockets], @opal[:maps_prefix] Wedge::Opal::Sprockets::SourceMapHeaderPatch.inject! @opal[:maps_prefix] end end @app = app @scope = self.class.scope @skip_call = !self.class.skip_call.nil?? self.class.skip_call : Wedge.config.skip_call_middleware end |
Class Attribute Details
.scope ⇒ Object
Returns the value of attribute scope.
40 41 42 |
# File 'lib/wedge/middleware.rb', line 40 def scope @scope end |
.skip_call ⇒ Object
Returns the value of attribute skip_call.
40 41 42 |
# File 'lib/wedge/middleware.rb', line 40 def skip_call @skip_call end |
Instance Attribute Details
#skip_call ⇒ Object (readonly)
Returns the value of attribute skip_call.
3 4 5 |
# File 'lib/wedge/middleware.rb', line 3 def skip_call @skip_call end |
Class Method Details
.call(env) ⇒ Object
49 50 51 |
# File 'lib/wedge/middleware.rb', line 49 def call env self.new.call env end |
.scope!(scope) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/wedge/middleware.rb', line 42 def scope! scope klass = Class.new(self) klass.instance_variable_set(:@scope, scope) klass.instance_variable_set(:@skip_call, false) klass end |