Class: Testdata::Unit

Inherits:
Object
  • Object
show all
Defined in:
lib/testdata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s) ⇒ Unit

Returns a new instance of Unit.



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/testdata.rb', line 268

def initialize(s)
  
  super()
  @a = []

  buffer, _ = RXFHelper.read(s)

  @doc = Rexle.new(buffer)

  @doc.root.xpath('records/test').map do |test|
    
    path, type, description = test.xpath('summary/*/text()')        
    records = test.element('records')        
    
    inputs = records.xpath('input/summary/*').map\
                                        {|x| [x.name, x.texts.join.strip]}

    outputs = records.xpath('output/summary/*').map\
                                        {|x| [x.name, x.texts.join.strip]}
    
    @a << {type: type, in: inputs, out: outputs}
    
  end

end

Instance Attribute Details

#to_sObject (readonly)

end of initialize()



294
295
296
# File 'lib/testdata.rb', line 294

def to_s
  @to_s
end