Module: Rfm::Factory
- Extended by:
- Config
- Defined in:
- lib/rfm/utilities/factory.rb
Defined Under Namespace
Classes: DbFactory, LayoutFactory, ScriptFactory, ServerFactory
Constant Summary
Constants included from Config
Config::CONFIG_DONT_STORE, Config::CONFIG_KEYS
Class Attribute Summary collapse
-
.models ⇒ Object
Acquired from Rfm::Base.
Class Method Summary collapse
-
.db(*conf) ⇒ Object
(also: database)
Returns Rfm::Db instance, given config hash or array.
-
.layout(*conf) ⇒ Object
Returns Rfm::Layout instance, given config hash or array.
-
.modelize(*args) ⇒ Object
Shortcut to Factory.db().layouts.modelize() If first parameter is regex, it is used for modelize filter.
-
.server(*conf) ⇒ Object
Returns Rfm::Server instance, given config hash or array.
- .servers ⇒ Object
Methods included from Config
config, config_clear, get_config, log, state
Class Attribute Details
.models ⇒ Object
Acquired from Rfm::Base
164 165 166 |
# File 'lib/rfm/utilities/factory.rb', line 164 def models @models end |
Class Method Details
.db(*conf) ⇒ Object Also known as: database
Returns Rfm::Db instance, given config hash or array
183 184 185 |
# File 'lib/rfm/utilities/factory.rb', line 183 def db(*conf) Database.new(*conf) end |
.layout(*conf) ⇒ Object
Returns Rfm::Layout instance, given config hash or array
190 191 192 |
# File 'lib/rfm/utilities/factory.rb', line 190 def layout(*conf) Layout.new(*conf) end |
.modelize(*args) ⇒ Object
Shortcut to Factory.db().layouts.modelize() If first parameter is regex, it is used for modelize filter. Otherwise, parameters are passed to Factory.database
168 169 170 171 |
# File 'lib/rfm/utilities/factory.rb', line 168 def modelize(*args) regx = args[0].is_a?(Regexp) ? args.shift : /.*/ db(*args).layouts.modelize(regx) end |
.server(*conf) ⇒ Object
Returns Rfm::Server instance, given config hash or array
178 179 180 |
# File 'lib/rfm/utilities/factory.rb', line 178 def server(*conf) Server.new(*conf) end |
.servers ⇒ Object
173 174 175 |
# File 'lib/rfm/utilities/factory.rb', line 173 def servers @servers ||= ServerFactory.new end |