From 6e4d41cc4ed35bb1b5eec0ef18ae924a37e99f95 Mon Sep 17 00:00:00 2001 From: Alex Pan Date: Mon, 18 Sep 2017 23:55:59 -0700 Subject: [PATCH] Fix minor formatting issues reported by Code Climate - Fix extra spaces inside parenthesis. - Add missing space after comment. - Remove extra empty lines at module beginning and end. - Fix one line that was over 80 character limit. - This should improve the overall GPA of the code base reported by Code Climate. --- lib/coinmarketcap.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/coinmarketcap.rb b/lib/coinmarketcap.rb index eb2f2b6..bb8e843 100644 --- a/lib/coinmarketcap.rb +++ b/lib/coinmarketcap.rb @@ -4,7 +4,6 @@ require 'nokogiri' module Coinmarketcap - def self.coins(limit = nil) if limit.nil? HTTParty.get('https://api.coinmarketcap.com/v1/ticker/') @@ -21,7 +20,7 @@ def self.global(currency = 'USD') HTTParty.get("https://api.coinmarketcap.com/v1/global/?convert=#{currency}") end - def self.get_historical_price(id, start_date, end_date) #20170908 + def self.get_historical_price(id, start_date, end_date) # 20170908 prices = [] doc = Nokogiri::HTML(open("https://coinmarketcap.com/currencies/#{id}/historical-data/?start=#{start_date}&end=#{end_date}")) rows = doc.css('tr') @@ -40,7 +39,7 @@ def self.get_historical_price(id, start_date, end_date) #20170908 price_bundle[:high] = each_row[2].text.to_f price_bundle[:low] = each_row[3].text.to_f price_bundle[:close] = each_row[4].text.to_f - price_bundle[:avg] = ( price_bundle[:high] + price_bundle[:low] ) / 2.0 + price_bundle[:avg] = (price_bundle[:high] + price_bundle[:low]) / 2.0 prices << price_bundle end rescue @@ -49,5 +48,4 @@ def self.get_historical_price(id, start_date, end_date) #20170908 end prices end - end