2015-08-13 01:48:17 +00:00
|
|
|
# encoding: utf-8
|
2015-08-13 02:07:01 +00:00
|
|
|
require 'utils/modulator'
|
2015-08-13 01:48:17 +00:00
|
|
|
|
|
|
|
module Vulcano
|
|
|
|
module Targets
|
2015-08-13 02:07:01 +00:00
|
|
|
extend Modulator
|
2015-08-13 01:48:17 +00:00
|
|
|
|
2015-08-13 03:47:02 +00:00
|
|
|
def self.__resolve(items)
|
|
|
|
items.map do |item|
|
|
|
|
|
|
|
|
end.flatten
|
|
|
|
end
|
|
|
|
|
2015-08-13 01:48:17 +00:00
|
|
|
def self.resolve(targets)
|
|
|
|
Array(targets).map do |target|
|
2015-08-13 02:07:01 +00:00
|
|
|
handler = modules.values.find{|m| m.handles?(target)}
|
2015-08-13 01:48:17 +00:00
|
|
|
if handler.nil?
|
|
|
|
raise "Don't know how to handle target: #{target}"
|
|
|
|
end
|
|
|
|
handler.resolve(target)
|
|
|
|
end.flatten
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|