Class: Monthly::Calculator
- Inherits:
-
Object
- Object
- Monthly::Calculator
- Defined in:
- lib/monthly/calculator.rb
Instance Attribute Summary collapse
-
#days_per_month ⇒ Object
readonly
Returns the value of attribute days_per_month.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(from, to, days_per_month = 30) ⇒ Calculator
constructor
A new instance of Calculator.
- #partial_months ⇒ Object
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_month ⇒ Object (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 |
#from ⇒ Object (readonly)
Returns the value of attribute from.
3 4 5 |
# File 'lib/monthly/calculator.rb', line 3 def from @from end |
#to ⇒ Object (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_months ⇒ Object
9 10 11 |
# File 'lib/monthly/calculator.rb', line 9 def partial_months months_between - partial_months_in_beginning - partial_months_in_end end |