Class: Mode::Connector::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/mode/connector/dispatcher.rb

Overview

Rename to Dispatcher

Constant Summary collapse

Commands =
Mode::Connector::Commands

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, data_sources) ⇒ Dispatcher

Returns a new instance of Dispatcher.



9
10
11
12
# File 'lib/mode/connector/dispatcher.rb', line 9

def initialize(resource, data_sources)
  @resource = resource
  @data_sources = data_sources
end

Instance Attribute Details

#data_sourcesObject (readonly)

Returns the value of attribute data_sources.



5
6
7
# File 'lib/mode/connector/dispatcher.rb', line 5

def data_sources
  @data_sources
end

#resourceObject (readonly)

Returns the value of attribute resource.



4
5
6
# File 'lib/mode/connector/dispatcher.rb', line 4

def resource
  @resource
end

Instance Method Details

#perform!Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/mode/connector/dispatcher.rb', line 14

def perform!
  case resource.command['name']
  when 'select:table:metadata'
    Commands::.new(resource, data_sources).perform!
  when 'select:report_run:dataset'
    Commands::SelectReportRunDataset.new(resource, data_sources).perform!
  end
rescue => err
  Mode::Logger.instance.error(
    self.class.name, err.message, err.backtrace)
end