Class: WhosDatedWho::Importer
- Inherits:
-
Object
- Object
- WhosDatedWho::Importer
- Includes:
- RethinkDB::Shortcuts
- Defined in:
- lib/whos_dated_who/importer.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
- #fetch_and_import(celebs) ⇒ Object
-
#initialize(db, table_name) ⇒ Importer
constructor
A new instance of Importer.
Constructor Details
#initialize(db, table_name) ⇒ Importer
6 7 8 9 10 |
# File 'lib/whos_dated_who/importer.rb', line 6 def initialize(db, table_name) @conn = r.connect(host: 'localhost', db: db || 'celebs') @logger = Logger.new(STDOUT) @table_name = table_name end |
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
4 5 6 |
# File 'lib/whos_dated_who/importer.rb', line 4 def conn @conn end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
4 5 6 |
# File 'lib/whos_dated_who/importer.rb', line 4 def logger @logger end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
4 5 6 |
# File 'lib/whos_dated_who/importer.rb', line 4 def table_name @table_name end |
Instance Method Details
#fetch_and_import(celebs) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/whos_dated_who/importer.rb', line 12 def fetch_and_import(celebs) celebs.each do |celeb| logger.info "Fetching #{celeb}" import_celeb(celeb) end end |