Class: CSVR::App
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
- #create(db, table) ⇒ Object
- #format ⇒ Object
-
#initialize(file) ⇒ App
constructor
A new instance of App.
- #parse ⇒ Object
Methods included from Format
Methods included from Parse
filter, headers, index, maximum, rows
Constructor Details
#initialize(file) ⇒ App
22 23 24 |
# File 'lib/csvr.rb', line 22 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
19 20 21 |
# File 'lib/csvr.rb', line 19 def file @file end |
#filters ⇒ Object
Returns the value of attribute filters.
20 21 22 |
# File 'lib/csvr.rb', line 20 def filters @filters end |
#headers ⇒ Object
Returns the value of attribute headers.
20 21 22 |
# File 'lib/csvr.rb', line 20 def headers @headers end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
19 20 21 |
# File 'lib/csvr.rb', line 19 def rows @rows end |
Instance Method Details
#create(db, table) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/csvr.rb', line 36 def create(db, table) self.parse self.format db = Database.new(db, table, @headers, @rows) db.create end |
#format ⇒ Object
31 32 33 34 |
# File 'lib/csvr.rb', line 31 def format @headers = Format.headers(@headers) @rows = @rows.map{ |row| Format.row(row) } end |
#parse ⇒ Object
26 27 28 29 |
# File 'lib/csvr.rb', line 26 def parse @headers ||= CSVR::Parse.headers(@file) @rows = CSVR::Parse.rows(@file, @headers, @filters) end |