Module: BrighterPlanet::Purchase::Summarization

Defined in:
lib/purchase/summarization.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/purchase/summarization.rb', line 6

def self.included(base)
  base.extend SummaryJudgement
  base.summarize do |has|
    has.identity 'purchase'

    has.verb :take
    has.aspect :perfect

    has.modifier lambda { |purchase| "from #{purchase.merchant}" }, :if => :merchant
    has.modifier lambda { |purchase| "(#{purchase.inudstry} industry)" }, :if => :industry
    has.modifier lambda { |purchase| "for $#{purchase.purchase_amount}" }, :if => :purchase_amount
    has.modifier lambda { |purchase| "on #{date.to_formatted_s(:archive)}" }, :if => :date
  end
end