Sha256: 4938780659b53d31dee5be8100430f56392db3cb92ab0a3b679043eb9dfb9dc5
Contents?: true
Size: 931 Bytes
Versions: 12
Compression:
Stored size: 931 Bytes
Contents
module Spree class Calculator < ActiveRecord::Base belongs_to :calculable, :polymorphic => true # This method must be overriden in concrete calculator. # # It should return amount computed based on #calculable and/or optional parameter def compute(something=nil) raise(NotImplementedError, 'please use concrete calculator') end # overwrite to provide description for your calculators def self.description "Base Caclulator" end ################################################################### def self.register(*klasses) end # Returns all calculators applicable for kind of work def self.calculators Rails.application.config.spree.calculators.all end def to_s self.class.name.titleize.gsub("Calculator\/", "") end def description self.class.description end def available?(object) true end end end
Version data entries
12 entries across 12 versions & 1 rubygems