class Navfund::Philamlife
Constants
- Funds
- MAIN_URL
Public Class Methods
new(main_url=nil)
click to toggle source
# File lib/navfund/providers/philamlife.rb, line 26 def initialize(main_url=nil) @url = main_url ||= MAIN_URL @funds = Funds self.scrape(:check_ssl => false) end
Public Instance Methods
find_fund_node(doc, fund)
click to toggle source
# File lib/navfund/providers/philamlife.rb, line 51 def find_fund_node(doc, fund) fname = nil if fund.match(/'/) # Fund name contains apostrophe, iterate nodeset and compare text instead tfund = fund.split('\'').last doc.search("[text()*='#{tfund}']").each do |tn| fname = tn if tn.text == fund end else fname = doc.search("[text()*='#{fund}']").first end fname end
value(fund, fund_type=nil)
click to toggle source
Fetch the current value
# File lib/navfund/providers/philamlife.rb, line 33 def value(fund, fund_type=nil) val = nil if valid_fund?(fund) fname = find_fund_node(@wrapped_document, fund) fval = fname.parent.next_element rescue nil val = Provider.strip_value(fval.text) if fval else raise InvalidFund end val end
value_at()
click to toggle source
# File lib/navfund/providers/philamlife.rb, line 45 def value_at dcontainer = @wrapped_document.search('div#detailcol3').first dtext = dcontainer.text.strip Date.strptime(dtext, "%m/%d/%Y") end