Class: Rhoconnect::Handler::PluginCallbacks::Runner

Inherits:
Object
  • Object
show all
Includes:
Helpers::Binding
Defined in:
lib/rhoconnect/handler/plugin_callbacks/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Binding

#bind_handler

Constructor Details

#initialize(route_handler, model, params = {}) ⇒ Runner

Returns a new instance of Runner.

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rhoconnect/handler/plugin_callbacks/runner.rb', line 9

def initialize(route_handler, model, params = {})
    raise ArgumentError.new(UNKNOWN_SOURCE) unless (model and model.source)
    raise ArgumentError.new('Invalid app for source') unless model.source.app
    raise ArgumentError.new('Invalid plugin_callbacks handler') unless route_handler
    # if handler is not bound - bind it to self
    # normally it should be bound to a Controller's instance
  
    @source = model.source
    @model = model
    @route_handler = bind_handler(:plugin_callback_handler_method, route_handler)  
    @params = params
end

Instance Attribute Details

#modelObject

Returns the value of attribute model.



5
6
7
# File 'lib/rhoconnect/handler/plugin_callbacks/runner.rb', line 5

def model
  @model
end

#paramsObject

Returns the value of attribute params.



5
6
7
# File 'lib/rhoconnect/handler/plugin_callbacks/runner.rb', line 5

def params
  @params
end

#route_handlerObject

Returns the value of attribute route_handler.



5
6
7
# File 'lib/rhoconnect/handler/plugin_callbacks/runner.rb', line 5

def route_handler
  @route_handler
end

#sourceObject

Returns the value of attribute source.



5
6
7
# File 'lib/rhoconnect/handler/plugin_callbacks/runner.rb', line 5

def source
  @source
end

Instance Method Details

#runObject



22
23
24
# File 'lib/rhoconnect/handler/plugin_callbacks/runner.rb', line 22

def run
  @route_handler.call
end