Class: Testdata
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
Instance Method Summary collapse
-
#initialize(s, options = {}) ⇒ Testdata
constructor
A new instance of Testdata.
- #run(x = nil, debug2 = nil) ⇒ Object
Constructor Details
#initialize(s, options = {}) ⇒ Testdata
Returns a new instance of Testdata.
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 |
# File 'lib/testdata.rb', line 20 def initialize(s, ={}) super() @params = {} #routes() @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 = Document.new(buffer) o = {log: false}.merge() @log = o[:log] == true ? Document.new(tests) : nil end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
18 19 20 |
# File 'lib/testdata.rb', line 18 def debug @debug end |
Instance Method Details
#run(x = nil, debug2 = nil) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/testdata.rb', line 53 def run(x=nil, debug2=nil) @debug2 = debug2 ? true : false @success = [] procs = {NilClass: :test_all, Range: :test_all, String: :test_id, Fixnum: :test_id} method(procs[x.class.to_s.to_sym]).call(x) summary() end |