Class: SimpleInvoice::BillingPeriodType
- Inherits:
-
Object
- Object
- SimpleInvoice::BillingPeriodType
- Defined in:
- lib/simple_invoice/billing_period_type.rb,
lib/simple_invoice/billing_period_type/weekly.rb,
lib/simple_invoice/billing_period_type/monthly.rb
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
- #first_day_of_next_period(first_day) ⇒ Object
-
#initialize(multiple = 1) ⇒ BillingPeriodType
constructor
A new instance of BillingPeriodType.
- #last_day_of_period(first_day) ⇒ Date
Constructor Details
#initialize(multiple = 1) ⇒ BillingPeriodType
Returns a new instance of BillingPeriodType.
28 29 30 |
# File 'lib/simple_invoice/billing_period_type.rb', line 28 def initialize multiple=1 @multiple = multiple end |
Class Method Details
.annually ⇒ Object
20 21 22 |
# File 'lib/simple_invoice/billing_period_type.rb', line 20 def self.annually Monthly.new 12 end |
.fortnightly ⇒ Object
8 9 10 |
# File 'lib/simple_invoice/billing_period_type.rb', line 8 def self.fortnightly Weekly.new 2 end |
.monthly ⇒ Object
12 13 14 |
# File 'lib/simple_invoice/billing_period_type.rb', line 12 def self.monthly Monthly.new 1 end |
Instance Method Details
#first_day_of_next_period(first_day) ⇒ Object
33 34 35 |
# File 'lib/simple_invoice/billing_period_type.rb', line 33 def first_day_of_next_period first_day raise "to be implemented in subclass" end |
#last_day_of_period(first_day) ⇒ Date
39 40 41 |
# File 'lib/simple_invoice/billing_period_type.rb', line 39 def last_day_of_period first_day first_day_of_next_period(first_day).prev_day end |