def option(name, options = {})
attribute = options[:as] || name
attribute_builder = options[:builder_class]
Builder.instance_eval do
remove_method name if method_defined?(name)
define_method name do |*args, &block|
value = if attribute_builder
attribute_builder.new(&block).build
else
block ? block : args.first
end
@config.instance_variable_set("@#{attribute}""@#{attribute}", value)
end
end
define_method attribute do |*_args|
if instance_variable_defined?("@#{attribute}""@#{attribute}")
instance_variable_get("@#{attribute}""@#{attribute}")
else
options[:default]
end
end
public attribute
end