class SimpleCSV::File
Public Class Methods
new(filename, *args)
click to toggle source
Calls superclass method
SimpleCSV::new
# File lib/SimpleCSV/File.rb, line 18 def initialize(filename, *args) @filename = filename @args = args super(source, *args) end
open(source, *args, &block)
click to toggle source
Calls superclass method
SimpleCSV::open
# File lib/SimpleCSV/File.rb, line 11 def open(source, *args, &block) @csv_file = new(source, *args) super(source, *args, &block) end
Public Instance Methods
filename()
click to toggle source
# File lib/SimpleCSV/File.rb, line 45 def filename @filename ||= File.expand_path(@filename) end
mode()
click to toggle source
# File lib/SimpleCSV/File.rb, line 28 def mode @mode ||= ( case @args.peek_options[:mode].to_s when 'r', 'r+', 'w', 'w+', 'a', 'a+'; @args.peek_options[:mode].to_s when 'read_only', 'read-only', 'readonly'; 'r' when 'rw', 'read_write', 'read-write', 'readwrite'; 'r+' when 'write_only', 'write-only', 'writeonly'; 'w' when 'append'; 'a' else 'r' end ) end
permissions()
click to toggle source
# File lib/SimpleCSV/File.rb, line 41 def permissions @permissions ||= @args.peek_options[:permissions] end
source()
click to toggle source
# File lib/SimpleCSV/File.rb, line 24 def source @source ||= ::File.new(filename, mode, permissions) end