lib/roi/rentability.rb in roi_calculator-2.1.0 vs lib/roi/rentability.rb in roi_calculator-2.2.0

- old
+ new

@@ -51,13 +51,11 @@ end filtered.map(&:rentability).compact end def volatility(months_ago = nil) - if months_ago - start = (end_date - months_ago.months + 1.month).beginning_of_month - end + start = (end_date - months_ago.months + 1.month).beginning_of_month if months_ago (volatility_in_window(nil, start).first || [])[1] end def volatility_in_window(days = nil, start_date = nil) filtered = rentabilities_array(start_date) @@ -71,12 +69,10 @@ end end def to_a dates_with_position.map do |date| - if @rentabilities[date] - [date.strftime('%Y-%m-%d'), @rentabilities[date].quota - 1] - end + [date.strftime('%Y-%m-%d'), @rentabilities[date].quota - 1] if @rentabilities[date] end.compact end protected