Class: TimePricing::Base
- Inherits:
-
Object
- Object
- TimePricing::Base
- Defined in:
- lib/time_pricing/base.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #add_plan!(**args) ⇒ Object
- #combine_plans? ⇒ Boolean
- #for_duration(duration) ⇒ Object
- #for_time(start_time, end_time) ⇒ Object
-
#initialize(config) ⇒ Base
constructor
A new instance of Base.
- #plans ⇒ Object
- #remove_plan!(name) ⇒ Object
Constructor Details
#initialize(config) ⇒ Base
Returns a new instance of Base.
5 6 7 |
# File 'lib/time_pricing/base.rb', line 5 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/time_pricing/base.rb', line 3 def config @config end |
Instance Method Details
#add_plan!(**args) ⇒ Object
13 14 15 |
# File 'lib/time_pricing/base.rb', line 13 def add_plan!(**args) @config.add_plan!(**args) end |
#combine_plans? ⇒ Boolean
21 22 23 |
# File 'lib/time_pricing/base.rb', line 21 def combine_plans? @config.combine_plans? end |
#for_duration(duration) ⇒ Object
29 30 31 |
# File 'lib/time_pricing/base.rb', line 29 def for_duration(duration) Calculation.new(config).for_duration(duration) end |
#for_time(start_time, end_time) ⇒ Object
25 26 27 |
# File 'lib/time_pricing/base.rb', line 25 def for_time(start_time, end_time) Calculation.new(config).for_time(start_time, end_time) end |
#plans ⇒ Object
9 10 11 |
# File 'lib/time_pricing/base.rb', line 9 def plans @config.plans end |
#remove_plan!(name) ⇒ Object
17 18 19 |
# File 'lib/time_pricing/base.rb', line 17 def remove_plan!(name) @config.remove_plan!(name) end |