Class: Rfm::Factory::DbFactory
- Inherits:
-
CaseInsensitiveHash
- Object
- Hash
- CaseInsensitiveHash
- Rfm::Factory::DbFactory
- Defined in:
- lib/rfm/utilities/factory.rb
Overview
:nodoc: all
Instance Method Summary collapse
- #[](*args) ⇒ Object
- #all ⇒ Object
-
#initialize(server) ⇒ DbFactory
constructor
extend Config config :parent=>‘@server’.
- #names ⇒ Object
Methods inherited from CaseInsensitiveHash
Methods inherited from Hash
#_create_accessor, #_merge_object!, #rfm_filter, #rfm_only, #to_cih
Constructor Details
Instance Method Details
#[](*args) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rfm/utilities/factory.rb', line 42 def [](*args) # was: (dbname, acnt=nil, pass=nil) = get_config(*args) name = [:strings].delete_at(0) || [:database] #account_name = options[:strings].delete_at(0) || options[:account_name] #password = options[:strings].delete_at(0) || options[:password] super(name) || (self[name] = Rfm::Database.new(@server, *args)) #(name, account_name, password, @server)) # This part reconfigures the named database, if you pass it new config in the [] method. # super(name).config({:account_name=>account_name, :password=>password}.merge(options)) if (account_name or password or options) # super(name) end |
#all ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/rfm/utilities/factory.rb', line 54 def all if !@loaded c = Connection.new('-dbnames', {}, {:grammar=>'FMPXMLRESULT'}, @server) c.parse('fmpxml_minimal.yml', {})['data'].each{|k,v| (self[k] = Rfm::Database.new(v['text'], @server)) if k.to_s != '' && v['text']} #r = c.parse('fmpxml_minimal.yml', {}) @loaded = true end self end |
#names ⇒ Object
64 65 66 |
# File 'lib/rfm/utilities/factory.rb', line 64 def names self.values.collect{|v| v.name} end |