Sha256: 0d7cd9a3e627b6c8d98225aac0b1c6516b88bb0223294c2f8be85dae37028ef6
Contents?: true
Size: 1.1 KB
Versions: 9
Compression:
Stored size: 1.1 KB
Contents
module Skr module Concerns # @see ClassMethods module ActsAsUOM extend ActiveSupport::Concern module ClassMethods def acts_as_uom( opts = {}) include InstanceMethods export_methods :ea_qty, :combined_uom, :optional=>false end end module InstanceMethods def combined_uom if self.uom_size.nil? || self.uom_code.nil? '' elsif 1 == self.uom_size self.uom_code else "#{self.uom_code}/#{self.uom_size}" end end def ea_qty self.uom_size * self.qty end def uom=(uom) self.uom_size = uom.size self.uom_code = uom.code end def uom Uom.new({ size: self.uom_size, code: self.uom_code }) end end end end end
Version data entries
9 entries across 9 versions & 2 rubygems