Class: Rack::EnyoJs

Inherits:
Object
  • Object
show all
Defined in:
lib/eris/lib/jasmine_config_overrides.rb

Instance Method Summary collapse

Constructor Details

#initialize(enyo_js_path) ⇒ EnyoJs

Returns a new instance of EnyoJs.



25
26
27
# File 'lib/eris/lib/jasmine_config_overrides.rb', line 25

def initialize(enyo_js_path)
  @enyo_js_path = "/#{enyo_js_path}"
end

Instance Method Details

#call(env) ⇒ Object



29
30
31
32
33
34
# File 'lib/eris/lib/jasmine_config_overrides.rb', line 29

def call(env)
  enyo_js = ::File.read(@enyo_js_path).gsub(/enyo\.args = \{\};/, "enyo.args = enyo.args || {};")
  [200,
   { "Content-Type"   => 'application/javascript' },
   [enyo_js]]
end