Class: DbMeta::Abstract
- Inherits:
-
Object
- Object
- DbMeta::Abstract
- Defined in:
- lib/db_meta/abstract.rb
Direct Known Subclasses
Constant Summary collapse
- TYPES =
{}
Class Method Summary collapse
Instance Method Summary collapse
- #extract(args = {}) ⇒ Object
- #fetch(args = {}) ⇒ Object
-
#initialize(args = {}) ⇒ Abstract
constructor
A new instance of Abstract.
Constructor Details
#initialize(args = {}) ⇒ Abstract
Returns a new instance of Abstract.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/db_meta/abstract.rb', line 14 def initialize(args = {}) @username = args[:username] @password = args[:password] @instance = args[:instance] @worker = args[:worker] || 10 @include = args[:include] @objects = [] @invalid_objects = Hash.new([]) @base_folder = args[:base_folder] || File.(File.join(Dir.pwd, "/#{@username}@#{@instance}")) raise "username is mandatory, pass a username argument during initialization" if @username.nil? raise "password is mandatory, pass a password argument during initialization" if @password.nil? raise "instance is mandatory, pass a instance argument during initialization" if @instance.nil? end |
Class Method Details
.from_type(type, args = {}) ⇒ Object
9 10 11 12 |
# File 'lib/db_meta/abstract.rb', line 9 def self.from_type(type, args = {}) raise "Abstract type [#{type}] is unknown" unless TYPES.key?(type) TYPES[type].new(args) end |
.register_type(type) ⇒ Object
5 6 7 |
# File 'lib/db_meta/abstract.rb', line 5 def self.register_type(type) TYPES[type] = self end |
Instance Method Details
#extract(args = {}) ⇒ Object
36 37 38 |
# File 'lib/db_meta/abstract.rb', line 36 def extract(args = {}) raise "Needs to be implemented in derived class" end |
#fetch(args = {}) ⇒ Object
32 33 34 |
# File 'lib/db_meta/abstract.rb', line 32 def fetch(args = {}) raise "Needs to be implemented in derived class" end |