Class: IEDriverServer::Helper::GoogleCodeParser
- Inherits:
-
Object
- Object
- IEDriverServer::Helper::GoogleCodeParser
- Defined in:
- lib/ie_driver_server/helper/google_code_parser.rb
Instance Attribute Summary collapse
-
#driver_name ⇒ Object
readonly
Returns the value of attribute driver_name.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #downloads ⇒ Object
-
#initialize(driver_name, url:, open_uri_provider: OpenURI) ⇒ GoogleCodeParser
constructor
A new instance of GoogleCodeParser.
- #newest_download ⇒ Object
Constructor Details
#initialize(driver_name, url:, open_uri_provider: OpenURI) ⇒ GoogleCodeParser
Returns a new instance of GoogleCodeParser.
10 11 12 13 14 |
# File 'lib/ie_driver_server/helper/google_code_parser.rb', line 10 def initialize(driver_name, url: , open_uri_provider: OpenURI) @driver_name = driver_name @url = url @source = open_uri_provider.open_uri(url) end |
Instance Attribute Details
#driver_name ⇒ Object (readonly)
Returns the value of attribute driver_name.
8 9 10 |
# File 'lib/ie_driver_server/helper/google_code_parser.rb', line 8 def driver_name @driver_name end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
8 9 10 |
# File 'lib/ie_driver_server/helper/google_code_parser.rb', line 8 def source @source end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/ie_driver_server/helper/google_code_parser.rb', line 8 def url @url end |
Instance Method Details
#downloads ⇒ Object
16 17 18 19 20 21 |
# File 'lib/ie_driver_server/helper/google_code_parser.rb', line 16 def downloads doc = Nokogiri::XML.parse(source) items = doc.css("Contents Key").collect {|k| k.text } items.reject! {|k| !(/#{driver_name}_/===k) } items.map {|k| "#{url}/#{k}"} end |
#newest_download ⇒ Object
23 24 25 |
# File 'lib/ie_driver_server/helper/google_code_parser.rb', line 23 def newest_download (downloads.sort { |a, b| version_of(a) <=> version_of(b)}).last end |