class Sheet::Write
Attributes
name[RW]
Public Class Methods
new(name=nil)
click to toggle source
# File lib/sheet/write.rb, line 5 def initialize(name=nil) @name = name end
Public Instance Methods
write()
click to toggle source
# File lib/sheet/write.rb, line 9 def write return Sheet.display("Please specify a name") unless name create_dir_if_doesnt_exist if editor_is_set? Sheet.exec("#{Sheet.editor} #{Sheet.sheet_path(name)}", true) else Sheet.display "Please set the $EDITOR variable to write files" end end
Private Instance Methods
create_dir_if_doesnt_exist()
click to toggle source
# File lib/sheet/write.rb, line 24 def create_dir_if_doesnt_exist if ! Sheet.sheets_directory_exists? Dir.mkdir(Sheet.sheets_dir) end end
editor_is_set?()
click to toggle source
# File lib/sheet/write.rb, line 20 def editor_is_set? (editor = Sheet.editor) && editor.length > 0 end