def using(*args, &block)
case args.first
when Hash
using :maven, *args
when Binding
using :erb, *args
when Symbol
raise ArgumentError, "Unknown mapping type: #{args.first}" unless respond_to?("#{args.first}_transform", true)
configure(*args, &block)
when Regexp
raise ArgumentError, 'Expected regular expression followed by mapping hash' unless args.size == 2 && Hash === args[1]
@mapper_type, @config = *args
else
unless args.empty? && block.nil?
raise ArgumentError, 'Expected proc, method or a block' if args.size > 1 || (args.first && block)
@mapper_type = :callback
config = args.first || block
raise ArgumentError, 'Expected proc, method or callable' unless config.respond_to?(:call)
@config = config
end
end
self
end