Last active
February 15, 2016 02:19
-
-
Save totzyuta/4a4ad6d974ccdb224ec6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
html = Nokogiri::HTML(File.open(File::expand_path('./source.txt'))) | |
prices = html.css('#kagKinDisp').map {|price| price.content.delete(",").to_i } | |
times = html.css('#hesKaisuDisp').map(&:content) | |
result = Array.new | |
prices.zip(times).each do |price, time| | |
price / 3 if time == "3" | |
result << price | |
end | |
p result.inject(:+) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment