Sha256: c44263c089f03a722c24fc49869998d8e25f342f429bccb6a7db9d203ac8af93
Contents?: true
Size: 1.05 KB
Versions: 41
Compression:
Stored size: 1.05 KB
Contents
module OrigenTesters::ATP # Program is the top-level container for a collection of test flows class Program # Load a program from a previously saved file def self.load(file) p = nil File.open(file) do |f| p = Marshal.load(f) end p end def flow(name, options = {}) flows[name] ||= Flow.new(self, name, options) end def flows @flows ||= {}.with_indifferent_access # To rescue previously created programs which have been loaded unless @flows.is_a?(ActiveSupport::HashWithIndifferentAccess) @flows = @flows.with_indifferent_access end @flows end # Save the program to a file def save(file) File.open(file, 'w') do |f| Marshal.dump(self, f) end end def respond_to?(*args) flows.key?(args.first) || super end def method_missing(method, *args, &block) # :nodoc: if f = flows[method] define_singleton_method method do f end f else super end end end end
Version data entries
41 entries across 41 versions & 1 rubygems