Class: Neverland::ScriptInjector

Inherits:
Object
  • Object
show all
Defined in:
lib/neverland/script_injector.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ScriptInjector

Returns a new instance of ScriptInjector.



7
8
9
10
11
12
13
14
# File 'lib/neverland/script_injector.rb', line 7

def initialize(response)
  case response
  when ActionDispatch::Response
    @injector = ActionDispatchScriptInjector.new(response)
  else
    @injector = NullScriptInjector.new(response)
  end
end

Class Method Details

.inject(response, params) ⇒ Object



3
4
5
# File 'lib/neverland/script_injector.rb', line 3

def self.inject(response, params)
  new(response).inject(params)
end

Instance Method Details

#inject(params) ⇒ Object



16
17
18
# File 'lib/neverland/script_injector.rb', line 16

def inject(params)
  @injector.inject(params)
end