Class: Chromedriver::Helper::GoogleCodeParser
- Inherits:
-
Object
- Object
- Chromedriver::Helper::GoogleCodeParser
- Defined in:
- lib/chromedriver2/helper/google_code_parser.rb
Constant Summary collapse
- BUCKET_URL =
'http://chromedriver.storage.googleapis.com'
Instance Attribute Summary collapse
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #downloads ⇒ Object
-
#initialize(platform) ⇒ GoogleCodeParser
constructor
A new instance of GoogleCodeParser.
- #newest_download ⇒ Object
Constructor Details
#initialize(platform) ⇒ GoogleCodeParser
Returns a new instance of GoogleCodeParser.
11 12 13 14 |
# File 'lib/chromedriver2/helper/google_code_parser.rb', line 11 def initialize(platform) @platform = platform @source = open(BUCKET_URL) end |
Instance Attribute Details
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
9 10 11 |
# File 'lib/chromedriver2/helper/google_code_parser.rb', line 9 def platform @platform end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
9 10 11 |
# File 'lib/chromedriver2/helper/google_code_parser.rb', line 9 def source @source end |
Instance Method Details
#downloads ⇒ Object
16 17 18 19 20 21 |
# File 'lib/chromedriver2/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| !(/chromedriver_#{platform}/===k) } items.map {|k| "#{BUCKET_URL}/#{k}"} end |
#newest_download ⇒ Object
23 24 25 |
# File 'lib/chromedriver2/helper/google_code_parser.rb', line 23 def newest_download downloads.last end |