Class: Monthly::Calculator

Inherits:
Object
  • Object
show all
Defined in:
lib/monthly/calculator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, to, days_per_month = 30) ⇒ Calculator

Returns a new instance of Calculator.



5
6
7
# File 'lib/monthly/calculator.rb', line 5

def initialize(from, to, days_per_month=30)
  @from, @to, @days_per_month = from, to, days_per_month
end

Instance Attribute Details

#days_per_monthObject (readonly)

Returns the value of attribute days_per_month.



3
4
5
# File 'lib/monthly/calculator.rb', line 3

def days_per_month
  @days_per_month
end

#fromObject (readonly)

Returns the value of attribute from.



3
4
5
# File 'lib/monthly/calculator.rb', line 3

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



3
4
5
# File 'lib/monthly/calculator.rb', line 3

def to
  @to
end

Instance Method Details

#partial_monthsObject



9
10
11
# File 'lib/monthly/calculator.rb', line 9

def partial_months
  months_between - partial_months_in_beginning - partial_months_in_end
end