Class: Montague::XMLExtractor::Header

Inherits:
Base
  • Object
show all
Defined in:
lib/montague/xml_extractor/header.rb

Overview

Header extractor

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Header

Returns a new instance of Header.


7
8
9
# File 'lib/montague/xml_extractor/header.rb', line 7

def initialize(xml)
  super
end

Instance Method Details

#api_controlString?

Returns:

  • (String, nil)

12
13
14
# File 'lib/montague/xml_extractor/header.rb', line 12

def api_control
  xpath_query_for_single_value(File.join header_path, 'apicontrol')
end

#hitsFixnum?

Returns:

  • (Fixnum, nil)

17
18
19
# File 'lib/montague/xml_extractor/header.rb', line 17

def hits
  xpath_query_for_single_value(File.join header_path, 'numhits').to_i
end

#messageString?

Returns:

  • (String, nil)

22
23
24
# File 'lib/montague/xml_extractor/header.rb', line 22

def message
  xpath_query_for_single_value(File.join header_path, 'message')
end

#modelMontague::Model::Header


32
33
34
35
36
37
38
39
# File 'lib/montague/xml_extractor/header.rb', line 32

def model
  m = Montague::Model::Header.new
  m.api_control = api_control
  m.hits = hits
  m.message = message
  m.outcome = outcome
  m
end

#outcomeString?

Returns:

  • (String, nil)

27
28
29
# File 'lib/montague/xml_extractor/header.rb', line 27

def outcome
  xpath_query_for_single_value(File.join header_path, 'outcome')
end