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
168 169 170 |
# File 'lib/rfm/utilities/factory.rb', line 168 def models @models end |
Class Method Details
.db(*conf) ⇒ Object Also known as: database
Returns Rfm::Db instance, given config hash or array
187 188 189 |
# File 'lib/rfm/utilities/factory.rb', line 187 def db(*conf) Database.new(*conf) end |
.layout(*conf) ⇒ Object
Returns Rfm::Layout instance, given config hash or array
194 195 196 |
# File 'lib/rfm/utilities/factory.rb', line 194 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
172 173 174 175 |
# File 'lib/rfm/utilities/factory.rb', line 172 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
182 183 184 |
# File 'lib/rfm/utilities/factory.rb', line 182 def server(*conf) Server.new(*conf) end |
.servers ⇒ Object
177 178 179 |
# File 'lib/rfm/utilities/factory.rb', line 177 def servers @servers ||= ServerFactory.new end |