Module: Rivendell::Import::Tasking::Destination

Included in:
Rivendell::Import::Task
Defined in:
lib/rivendell/import/tasking/destination.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



13
14
15
16
17
# File 'lib/rivendell/import/tasking/destination.rb', line 13

def self.included(base)
  base.class_eval do
    before_save :destination, :on => :create
  end
end

Instance Method Details

#calculate_destinationObject



19
20
21
22
23
24
25
# File 'lib/rivendell/import/tasking/destination.rb', line 19

def calculate_destination
  if cart.number
    "Cart #{cart.number}"
  elsif cart.group
    "Cart in group #{cart.group}" 
  end
end

#destinationObject



4
5
6
7
# File 'lib/rivendell/import/tasking/destination.rb', line 4

def destination
  read_attribute(:destination) or
    write_attribute(:destination, calculate_destination)
end

#reset_destination!Object



9
10
11
# File 'lib/rivendell/import/tasking/destination.rb', line 9

def reset_destination!
  write_attribute :destination, nil
end