Class: DbMeta::DbMeta

Inherits:
Object
  • Object
show all
Defined in:
lib/db_meta.rb

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ DbMeta

Returns a new instance of DbMeta.



14
15
16
17
18
# File 'lib/db_meta.rb', line 14

def initialize(args = {})
  @database_type = args[:database_type] || DATABASE_TYPES[0]
  raise "allowed database types are [#{DATABASE_TYPES.join(", ")}], but provided was [#{@database_type}]" unless DATABASE_TYPES.include?(@database_type)
  @abstract = Abstract.from_type(@database_type, args)
end

Instance Method Details

#extract(args = {}) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/db_meta.rb', line 28

def extract(args = {})
  Log.info("Extracting...")
  @abstract.extract(args)
  Log.info("Extraction completed")
rescue => e
  Log.error(e.to_s)
  Log.error(e.backtrace.join("\n"))
end

#fetch(args = {}) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/db_meta.rb', line 20

def fetch(args = {})
  Log.info("Fetching...")
  @abstract.fetch(args)
  Log.info("Fetch completed")
rescue => e
  Log.error(e.backtrace.join("\n"))
end