Class: Testdata::Base
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
Instance Method Summary collapse
-
#initialize(s, options = {}) ⇒ Base
constructor
A new instance of Base.
- #run(raw_x = nil, debug2 = nil) ⇒ Object
Constructor Details
#initialize(s, options = {}) ⇒ Base
Returns a new instance of Base.
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 |
# File 'lib/testdata.rb', line 23 def initialize(s, ={}) super() @params = {} @success = [] # used by summary @debug = false # open the testdata document procs = { String: proc {|x| if x.strip[/^</] then x elsif x[/https?:\/\//] then read_url x else read_file x end }, Polyrex: proc {|x| x.to_xml} } buffer = procs[s.class.to_s.to_sym].call(s) @doc = Rexle.new(buffer) o = {log: false}.merge() @log = o[:log] == true ? Rexle.new(tests) : nil end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
21 22 23 |
# File 'lib/testdata.rb', line 21 def debug @debug end |
Instance Method Details
#run(raw_x = nil, debug2 = nil) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/testdata.rb', line 56 def run(raw_x=nil, debug2=nil) @debug2 = debug2 ? true : false @success = [] x = if raw_x and raw_x[/\d+\.\.\d+/] then x, y = raw_x.split('..').map(&:to_i) id = Range.new(x,y) else raw_x end procs = {NilClass: :test_all, Range: :test_range, String: :test_id, Integer: :test_id, Fixnum: :test_id} method(procs[x.class.to_s.to_sym]).call(x) summary() end |