Class: UsageMod::FileOutputQueryPlugin

Inherits:
FilePlugin show all
Defined in:
lib/Usage.rb

Instance Attribute Summary

Attributes inherited from ArgumentParserPlugin

#value

Instance Method Summary collapse

Methods inherited from FilePlugin

#close

Methods inherited from ArgumentParserPlugin

#close

Constructor Details

#initialize(usage_ui, str) ⇒ FileOutputQueryPlugin

Returns a new instance of FileOutputQueryPlugin.



487
488
489
490
491
492
493
# File 'lib/Usage.rb', line 487

def initialize(usage_ui, str)
	$TRACE.debug 5, "trying to open file '#{str}' for output"
	if FileTest.exist?(str) then
		raise FileOutputExistsError.new(str) if usage_ui.ask_yes_no(OVERWRITE_QUERY % str, NO_RESPONSE) == NO_RESPONSE
	end
	@value = File.open(str, "w")
end