Class: FreeZipcodeData::DbTable
- Inherits:
-
Object
- Object
- FreeZipcodeData::DbTable
- Defined in:
- lib/free_zipcode_data/db_table.rb
Direct Known Subclasses
Constant Summary collapse
- ISSUE_URL =
'https://github.com/midwire/free_zipcode_data/issues/new'
- @@progressbar =
nil
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#tablename ⇒ Object
readonly
Returns the value of attribute tablename.
Instance Method Summary collapse
-
#initialize(database:, tablename:) ⇒ DbTable
constructor
A new instance of DbTable.
- #update_progress ⇒ Object
Constructor Details
#initialize(database:, tablename:) ⇒ DbTable
Returns a new instance of DbTable.
13 14 15 16 17 18 |
# File 'lib/free_zipcode_data/db_table.rb', line 13 def initialize(database:, tablename:) @database = database @tablename = tablename lc = select_first('SELECT value FROM meta where name = "line_count"') @@progressbar = ProgressBar.create(total: lc.to_i * 4, format: '%t: |%B| %e') end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
10 11 12 |
# File 'lib/free_zipcode_data/db_table.rb', line 10 def database @database end |
#tablename ⇒ Object (readonly)
Returns the value of attribute tablename.
10 11 12 |
# File 'lib/free_zipcode_data/db_table.rb', line 10 def tablename @tablename end |
Instance Method Details
#update_progress ⇒ Object
20 21 22 |
# File 'lib/free_zipcode_data/db_table.rb', line 20 def update_progress @@progressbar.increment end |