Created
April 21, 2011 12:15
-
-
Save lolmaus/934361 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DB_CSV < DB | |
def initialize | |
@filepath = File.join(APP_ROOT, Conf[:db_name] + ".csv") | |
end | |
def db_accessible? | |
return true if @filepath && | |
File.exists?(@filepath) && | |
File.readable?(@filepath) && | |
File.writable?(@filepath) | |
# Конец if | |
end | |
def db_init | |
File.open(@filepath, 'w') unless db_accessible? | |
return db_accessible? | |
end | |
def add(arr) | |
CSV.open(@@filepath, 'a:UTF-8') do |writer| | |
writer << arr | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment