Class: Meteoroid::File

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ File

Returns a new instance of File.



5
6
7
8
# File 'lib/meteoroid/file.rb', line 5

def initialize(file)
  @file = file
  @xml  = parse_xml(file)
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



3
4
5
# File 'lib/meteoroid/file.rb', line 3

def file
  @file
end

#validObject (readonly)

Returns the value of attribute valid.



3
4
5
# File 'lib/meteoroid/file.rb', line 3

def valid
  @valid
end

#xmlObject (readonly)

Returns the value of attribute xml.



3
4
5
# File 'lib/meteoroid/file.rb', line 3

def xml
  @xml
end

Class Method Details

.from(args) ⇒ Object



10
11
12
13
14
15
# File 'lib/meteoroid/file.rb', line 10

def self.from args
  args.collect do |arg| 
    file = new(arg)
    file.valid ? file : nil
  end.compact
end

Instance Method Details

#samplesObject



17
18
19
20
21
# File 'lib/meteoroid/file.rb', line 17

def samples
  @samples ||= @xml.xpath('/testResults/httpSample').collect do |sample|
    Meteoroid::Sample.from_xml(sample.attribute_nodes, sample.at_xpath('java.net.URL').text)
  end
end