Class: RScriptRW
- Inherits:
-
RScript
- Object
- RScript
- RScriptRW
- Defined in:
- lib/rsf_services.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(log: log) ⇒ RScriptRW
constructor
A new instance of RScriptRW.
- #read(args = []) ⇒ Object
Constructor Details
#initialize(log: log) ⇒ RScriptRW
Returns a new instance of RScriptRW.
13 14 15 |
# File 'lib/rsf_services.rb', line 13 def initialize(log: log) super(log: log) end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
11 12 13 |
# File 'lib/rsf_services.rb', line 11 def type @type end |
Instance Method Details
#read(args = []) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rsf_services.rb', line 17 def read(args=[]) @log.info 'RScript/read: args: ' + args.inspect if @log threads = [] if args.to_s[/\/\/job:/] then ajob = '' args.each_index do |i| if args[i].to_s[/\/\/job:/] then ajob = $'; args[i] = nil end end args.compact! a = read_rsfdoc(args) job = a.find do |xy| name, x = xy name == ajob.to_sym and (x[:attributes][:type] || type.to_s == self.type.to_s) end.last out, attr = job[:code], job[:attributes] raise "job not found" unless out.length > 0 out else out = read_rsfdoc(args).map {|x| x.last[:code]}.join("\n") end @log.info 'RScript/read: code: ' + out.inspect if @log [out, args] end |