Class: QbwcRequests::Factory::Instantiator

Inherits:
Object
  • Object
show all
Defined in:
lib/qbwc_requests/factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(module_name, klass) ⇒ Instantiator

Returns a new instance of Instantiator.



6
7
8
9
# File 'lib/qbwc_requests/factory.rb', line 6

def initialize module_name, klass
  @module_name = module_name
  @klass = klass
end

Instance Method Details

#factory(params = {}, version = nil) ⇒ Object



11
12
13
14
15
# File 'lib/qbwc_requests/factory.rb', line 11

def factory params = {}, version = nil
  final_version = version || QbwcRequests.QBXML_VERSION
  object = Object.const_get("QbwcRequests::#{@module_name}::V#{final_version}::#{@klass}")
  object.new(params)
end

#nameObject



17
18
19
# File 'lib/qbwc_requests/factory.rb', line 17

def name
  @module_name
end