Class: Rfm::Factory::LayoutFactory
- Inherits:
-
CaseInsensitiveHash
- Object
- Hash
- CaseInsensitiveHash
- Rfm::Factory::LayoutFactory
- Defined in:
- lib/rfm/utilities/factory.rb
Instance Method Summary collapse
- #[](layout_name) ⇒ Object
- #all ⇒ Object
-
#initialize(server, database) ⇒ LayoutFactory
constructor
A new instance of LayoutFactory.
Methods inherited from CaseInsensitiveHash
Constructor Details
#initialize(server, database) ⇒ LayoutFactory
Returns a new instance of LayoutFactory.
36 37 38 39 40 |
# File 'lib/rfm/utilities/factory.rb', line 36 def initialize(server, database) @server = server @database = database @loaded = false end |
Instance Method Details
#[](layout_name) ⇒ Object
42 43 44 |
# File 'lib/rfm/utilities/factory.rb', line 42 def [](layout_name) super or (self[layout_name] = Rfm::Layout.new(layout_name, @database)) end |
#all ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rfm/utilities/factory.rb', line 46 def all if !@loaded Rfm::Result::ResultSet.new(@server, @server.connect('-layoutnames', {"-db" => @database.name}).body).each {|record| name = record['LAYOUT_NAME'] self[name] = Rfm::Layout.new(name, @database) if self[name] == nil } @loaded = true end self.values end |