Class: Rfm::Factory::LayoutFactory

Inherits:
CaseInsensitiveHash show all
Extended by:
Config
Defined in:
lib/rfm/utilities/factory.rb

Overview

:nodoc: all

Constant Summary

Constants included from Config

Config::CONFIG_DONT_STORE, Config::CONFIG_KEYS

Instance Method Summary (collapse)

Methods included from Config

config, config_clear, get_config, log, state

Methods inherited from CaseInsensitiveHash

#[]=

Methods inherited from Hash

#_create_accessors, #_merge_object!, #rfm_filter, #rfm_only, #to_cih

Constructor Details

- (LayoutFactory) initialize(server, database)



79
80
81
82
83
# File 'lib/rfm/utilities/factory.rb', line 79

def initialize(server, database)
  @server = server
  @database = database
  @loaded = false
end

Instance Method Details

- (Object) [](*args)

was layout_name



85
86
87
88
89
90
91
92
# File 'lib/rfm/utilities/factory.rb', line 85

def [](*args) # was layout_name
	options = get_config(*args)
	name = options[:strings].delete_at(0) || options[:layout]
  super(name) || (self[name] = Rfm::Layout.new(@database, *args))   #(name, @database, options))
  # This part reconfigures the named layout, if you pass it new config in the [] method.
				#   super(name).config({:layout=>name}.merge(options)) if options
				#   super(name)
end

- (Object) all



94
95
96
97
98
99
100
101
# File 'lib/rfm/utilities/factory.rb', line 94

def all
  if !@loaded
					c = Connection.new('-layoutnames', {"-db" => @database.name}, {:grammar=>'FMPXMLRESULT'}, @database)
					c.parse('fmpxml_minimal.yml', {})['data'].each{|k,v| (self[k] = Rfm::Layout.new(v['text'], @database)) if k.to_s != '' && v['text']}
    @loaded = true
  end
  self
end

- (Object) modelize(filter = /.*/)

Acquired from Rfm::Base



108
109
110
111
# File 'lib/rfm/utilities/factory.rb', line 108

def modelize(filter = /.*/)
	all.values.each{|lay| lay.modelize if lay.name.match(filter)}
	models
end

- (Object) models

Acquired from Rfm::Base



114
115
116
117
118
119
120
121
# File 'lib/rfm/utilities/factory.rb', line 114

def models
	rslt = {}
	each do |k,lay|
		layout_models = lay.models
		rslt[k] = layout_models if (!layout_models.nil? && !layout_models.empty?)
	end
	rslt
end

- (Object) names



103
104
105
# File 'lib/rfm/utilities/factory.rb', line 103

def names
	values.collect{|v| v.name}
end