Class: Rfm::Factory::ScriptFactory

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

- (ScriptFactory) initialize(server, database)



132
133
134
135
136
# File 'lib/rfm/utilities/factory.rb', line 132

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

Instance Method Details

- (Object) [](script_name)



138
139
140
# File 'lib/rfm/utilities/factory.rb', line 138

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

- (Object) all



142
143
144
145
146
147
148
149
# File 'lib/rfm/utilities/factory.rb', line 142

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



151
152
153
# File 'lib/rfm/utilities/factory.rb', line 151

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