def self.new(attribute, options)
conditions = compile_conditions(options)
base_args = [attribute, options, conditions]
if options[:proc]
block_exposure = BlockExposure.new(*base_args, &options[:proc])
else
delegator_exposure = DelegatorExposure.new(*base_args)
end
if options[:using]
using_class = options[:using]
if options[:proc]
RepresentExposure.new(*base_args, using_class, block_exposure)
else
RepresentExposure.new(*base_args, using_class, delegator_exposure)
end
elsif options[:proc]
block_exposure
elsif options[:format_with]
format_with = options[:format_with]
if format_with.is_a? Symbol
FormatterExposure.new(*base_args, format_with)
elsif format_with.respond_to? :call
FormatterBlockExposure.new(*base_args, &format_with)
end
elsif options[:nesting]
NestingExposure.new(*base_args)
else
delegator_exposure
end
end