Module: ROI::RentabilityPeriods
- Included in:
- Rentability
- Defined in:
- lib/roi/rentability_periods.rb
Instance Method Summary collapse
- #current_month ⇒ Object
- #current_year ⇒ Object
- #days(days_amount = 1) ⇒ Object
- #months(amount, date = end_date) ⇒ Object
- #portfolio ⇒ Object
- #years_ago(amount) ⇒ Object
Instance Method Details
#current_month ⇒ Object
10 11 12 13 |
# File 'lib/roi/rentability_periods.rb', line 10 def current_month scoped_start = WorkDay.last_until((end_date - 1.month).end_of_month) check_gaps_and_format(adjust_start_date(scoped_start), end_date) end |
#current_year ⇒ Object
21 22 23 24 |
# File 'lib/roi/rentability_periods.rb', line 21 def current_year scoped_start = WorkDay.last_until((end_date - 1.year).end_of_year) format(adjust_start_date(scoped_start), end_date) end |
#days(days_amount = 1) ⇒ Object
5 6 7 8 |
# File 'lib/roi/rentability_periods.rb', line 5 def days(days_amount = 1) scoped_start = WorkDay.last_until(end_date - days_amount) format(scoped_start, end_date) end |
#months(amount, date = end_date) ⇒ Object
15 16 17 18 19 |
# File 'lib/roi/rentability_periods.rb', line 15 def months(amount, date = end_date) scoped_start = WorkDay.last_until((date - (amount+1).month).end_of_month) scoped_end = adjust_end_date((date - 1.month).end_of_month) check_gaps_and_format(scoped_start, scoped_end) end |
#portfolio ⇒ Object
32 33 34 |
# File 'lib/roi/rentability_periods.rb', line 32 def portfolio format(start_date, end_date) end |
#years_ago(amount) ⇒ Object
26 27 28 29 30 |
# File 'lib/roi/rentability_periods.rb', line 26 def years_ago(amount) scoped_end = WorkDay.last_until((end_date - amount.year).end_of_year) scoped_start = WorkDay.last_until((scoped_end - 1.year).end_of_year) format(adjust_start_date(scoped_start), scoped_end) end |