Class: Sovren::Military
- Inherits:
-
Object
- Object
- Sovren::Military
- Defined in:
- lib/sovren/military.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#country_served ⇒ Object
Returns the value of attribute country_served.
-
#discharge_status ⇒ Object
Returns the value of attribute discharge_status.
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#rank_achieved ⇒ Object
Returns the value of attribute rank_achieved.
-
#recognition_achieved ⇒ Object
Returns the value of attribute recognition_achieved.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
Class Method Summary collapse
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
3 4 5 |
# File 'lib/sovren/military.rb', line 3 def branch @branch end |
#country_served ⇒ Object
Returns the value of attribute country_served.
3 4 5 |
# File 'lib/sovren/military.rb', line 3 def country_served @country_served end |
#discharge_status ⇒ Object
Returns the value of attribute discharge_status.
3 4 5 |
# File 'lib/sovren/military.rb', line 3 def discharge_status @discharge_status end |
#end_date ⇒ Object
Returns the value of attribute end_date.
3 4 5 |
# File 'lib/sovren/military.rb', line 3 def end_date @end_date end |
#rank_achieved ⇒ Object
Returns the value of attribute rank_achieved.
3 4 5 |
# File 'lib/sovren/military.rb', line 3 def rank_achieved @rank_achieved end |
#recognition_achieved ⇒ Object
Returns the value of attribute recognition_achieved.
3 4 5 |
# File 'lib/sovren/military.rb', line 3 def recognition_achieved @recognition_achieved end |
#start_date ⇒ Object
Returns the value of attribute start_date.
3 4 5 |
# File 'lib/sovren/military.rb', line 3 def start_date @start_date end |
Class Method Details
.parse(military_history) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/sovren/military.rb', line 5 def self.parse(military_history) return nil if military_history.nil? e = Military.new e.country_served = military_history.css('CountryServed').text e.branch = military_history.css('ServiceDetail').first['branch'] e.rank_achieved = military_history.css('ServiceDetail RankAchieved CurrentOrEndRank').text e.recognition_achieved = military_history.css('ServiceDetail RecognitionAchieved').text e.discharge_status = military_history.css('ServiceDetail DischargeStatus').text e.start_date = Date.parse(military_history.css('DatesOfService StartDate AnyDate').text) rescue nil e.end_date = Date.parse(military_history.css('DatesOfService EndDate AnyDate').text) rescue nil e end |