class RSFServices::Package
Public Class Methods
new(obj, package, debug: false)
click to toggle source
# File lib/rsf_services.rb, line 31 def initialize(obj, package, debug: false) puts 'inside Package#initialize' if debug @obj, @package, @debug = obj, package, debug @url = File.join(@obj.package_basepath, package + '.rsf') puts 'before Rexle' if @debug puts '@url: ' + @url.inspect if @debug s, _ = RXFReader.read(@url) puts 's: ' + s.inspect if @debug doc = Rexle.new s puts 'before xpath' if @debug a = doc.root.xpath 'job/attribute::id' a.each do |attr| method_name = attr.value.gsub('-','_') define_singleton_method method_name.to_sym do |*args| run_job method_name, args end end end
Private Instance Methods
run_job(method_name, *args)
click to toggle source
# File lib/rsf_services.rb, line 65 def run_job(method_name, *args) puts 'inside Package::run_job: args: ' + args.inspect if @debug args.flatten!(1) params = args.find {|x| x.is_a? Hash} ? args.pop : {} a = ['//job:' + method_name, @url, args].flatten(1) if @debug then puts 'a: ' + a.inspect puts 'params: ' + params.inspect end @obj.run a, params end