lib/bitcoin/display.rb in bitcoin-api-0.1.0 vs lib/bitcoin/display.rb in bitcoin-api-0.1.1
- old
+ new
@@ -26,19 +26,20 @@
def self.list_candles(candles)
candles.each_with_index{ |candle, i|
puts "#{(i+1).to_s.rjust(4)}. #{candle.timestamp} [#{candle.open.rjust(11)} -> #{candle.close.rjust(11)}] [#{candle.min.rjust(11)} - #{candle.max.rjust(11)}] vol: #{candle.volume.rjust(11)}"
}
+ # insert key at top and bottom of list
end
def self.list_tickers(tickers)
tickers.each_with_index{ |ticker, i|
puts "#{(i+1).to_s.rjust(4)}. #{ticker.symbol}"
}
end
private
- # input array of hashes, and desired displayed attribute (string key)
+ # input array of hashes, and attribute to be displayed
def self.numerize(array, attribute = nil)
if attribute
array.each_with_index{ |e, i| puts "#{i+1}. #{e.send("#{attribute}")}"}
else
array.each_with_index{ |e, i| puts "#{i+1}. #{e}"}