Class: CampaignProduction
- Inherits:
-
Object
- Object
- CampaignProduction
- Defined in:
- app/models/campaign_production.rb
Overview
A CampaignProduction is a the same as an ActivityProduction for annual production but it represents the “year” of campaign or perennial productions.
Instance Attribute Summary collapse
-
#activity_production ⇒ Object
readonly
Returns the value of attribute activity_production.
-
#campaign ⇒ Object
readonly
Returns the value of attribute campaign.
Class Method Summary collapse
Instance Method Summary collapse
-
#cost_amount ⇒ Object
Compute cost amount in global currency for the current campaign production Cost is the sum of all.
-
#initialize(campaign, activity_production) ⇒ CampaignProduction
constructor
A new instance of CampaignProduction.
- #started_on ⇒ Object
- #stopped_on ⇒ Object
Constructor Details
#initialize(campaign, activity_production) ⇒ CampaignProduction
Returns a new instance of CampaignProduction.
14 15 16 17 |
# File 'app/models/campaign_production.rb', line 14 def initialize(campaign, activity_production) @campaign = campaign @activity_production = activity_production end |
Instance Attribute Details
#activity_production ⇒ Object (readonly)
Returns the value of attribute activity_production
4 5 6 |
# File 'app/models/campaign_production.rb', line 4 def activity_production @activity_production end |
#campaign ⇒ Object (readonly)
Returns the value of attribute campaign
4 5 6 |
# File 'app/models/campaign_production.rb', line 4 def campaign @campaign end |
Class Method Details
.of(campaign) ⇒ Object
8 9 10 11 12 |
# File 'app/models/campaign_production.rb', line 8 def self.of(campaign) campaign.activity_productions.map do |p| new(campaign, p) end end |
Instance Method Details
#cost_amount ⇒ Object
Compute cost amount in global currency for the current campaign production Cost is the sum of all
29 |
# File 'app/models/campaign_production.rb', line 29 def cost_amount; end |
#started_on ⇒ Object
19 20 21 |
# File 'app/models/campaign_production.rb', line 19 def started_on @started_on ||= @activity_production.started_on_for(@campaign) end |
#stopped_on ⇒ Object
23 24 25 |
# File 'app/models/campaign_production.rb', line 23 def stopped_on @stopped_on ||= @activity_production.stopped_on_for(@campaign) end |