Module: Sem4r::AccountCampaignExtension
- Included in:
- Account
- Defined in:
- lib/sem4r/campaign/campaign_account_extension.rb
Instance Method Summary collapse
-
#campaign(name = nil, &block) ⇒ Object
(also: #create_campaign)
TODO: accettare un parametro opzionale campaign(name=nil,&block) la campagna che verra’ creata ha il nome gia’ settato se esiste gia’ una campagna con quel nome allora fara’ da contesto e non verra’ creata.
-
#campaigns(refresh = false, opts = {}) ⇒ Object
conditions = nil.
-
#p_campaigns(refresh = false, opts = {}) ⇒ Object
conditions = nil.
Instance Method Details
#campaign(name = nil, &block) ⇒ Object Also known as: create_campaign
TODO: accettare un parametro opzionale campaign(name=nil,&block)
la campagna che verra' creata ha il nome gia' settato
se esiste gia' una campagna con quel nome allora fara' da contesto
e non verra' creata
35 36 37 38 39 40 41 |
# File 'lib/sem4r/campaign/campaign_account_extension.rb', line 35 def campaign(name = nil, &block) campaign = Campaign.new(self, name, &block) campaign.save @campaigns ||= [] @campaigns.push(campaign) campaign end |
#campaigns(refresh = false, opts = {}) ⇒ Object
conditions = nil
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/sem4r/campaign/campaign_account_extension.rb', line 45 def campaigns(refresh = false, opts = {}) # conditions = nil if refresh.respond_to?(:keys) opts = refresh refresh = false end _campaigns unless @campaigns and !refresh @campaigns # return @campaigns unless conditions # @campaigns.find_all {|c| c.name =~ conditions} end |
#p_campaigns(refresh = false, opts = {}) ⇒ Object
conditions = nil
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/sem4r/campaign/campaign_account_extension.rb', line 56 def p_campaigns(refresh = false, opts = {}) # conditions = nil if refresh.respond_to?(:keys) opts = refresh refresh = false end cs = campaigns(refresh, opts) puts "#{cs.length} campaigns" campaigns(refresh).each do |campaign| puts campaign.to_s end self end |