Class: Disloku::Config::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/disloku/config/Target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, targetConfig, mappingStore, connectionStore) ⇒ Target

Returns a new instance of Target.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/disloku/config/Target.rb', line 10

def initialize(name, targetConfig, mappingStore, connectionStore)
	@name = name
	@config = targetConfig

	if (@config["connection"].value().kind_of?(String))
		@connection = connectionStore.get(@config["connection"].value())
	else
		@connection = Connection.new(@config["connection"])
	end

	@mapping = Mapping.new(@config, mappingStore)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/disloku/config/Target.rb', line 27

def method_missing(name, *args, &block)
	if (!@config.has?(name.to_s()))
		return nil
	end

	return @config[name.to_s()].value()
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



8
9
10
# File 'lib/disloku/config/Target.rb', line 8

def connection
  @connection
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/disloku/config/Target.rb', line 8

def name
  @name
end

Instance Method Details

#mapPath(pathSegments) ⇒ Object



23
24
25
# File 'lib/disloku/config/Target.rb', line 23

def mapPath(pathSegments)
	return @mapping.mapPath(pathSegments)
end