Class: UsageMod::FileAppendQueryPlugin

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) ⇒ FileAppendQueryPlugin



504
505
506
507
508
509
510
511
# File 'lib/Usage.rb', line 504

def initialize(usage_ui, str)
	$TRACE.debug 5, "trying to open file '#{str}' for append(query)"
	if !FileTest.exist?(str) then
		$TRACE.debug 5, "file doesn't exist"
		raise FileAppendDoesntExistError.new(str) if usage_ui.ask_yes_no(APPEND_NO_EXIST_QUERY % str, NO_RESPONSE) == NO_RESPONSE
	end
	@value = File.open(str, "a")
end