Class: Rfm::Factory::ScriptFactory

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

Overview

:nodoc: all

Instance Method Summary (collapse)

Methods inherited from CaseInsensitiveHash

#[]=

Methods inherited from Hash

#_create_accessor, #_merge_object!, #rfm_filter, #rfm_only, #to_cih

Constructor Details

- (ScriptFactory) initialize(server, database)

extend Config config :parent=>'@database'



136
137
138
139
140
141
142
# File 'lib/rfm/utilities/factory.rb', line 136

def initialize(server, database)
	  	extend Config
	  	config :parent=>'@database'
  @server = server
  @database = database
  @loaded = false
end

Instance Method Details

- (Object) [](script_name)



144
145
146
# File 'lib/rfm/utilities/factory.rb', line 144

def [](script_name)
  super or (self[script_name] = Rfm::Metadata::Script.new(script_name, @database))
end

- (Object) all



148
149
150
151
152
153
154
155
# File 'lib/rfm/utilities/factory.rb', line 148

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

- (Object) names



157
158
159
# File 'lib/rfm/utilities/factory.rb', line 157

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