Sha256: ae98a6f6677176c9ff8b32174d6793ae47085297efad7d5d1b2e9c105ec4a28d
Contents?: true
Size: 466 Bytes
Versions: 62
Compression:
Stored size: 466 Bytes
Contents
module Workarea module NewDiscount def self.new_discount(type, attributes) return nil unless valid_class?(type) klass = "Workarea::Pricing::Discount::#{type.to_s.classify}".constantize klass.new(attributes) end def self.valid_class?(type) return false if type.to_s.blank? discount_class = type.to_s.demodulize.classify !!"Workarea::Pricing::Discount::#{discount_class}".constantize rescue false end end end
Version data entries
62 entries across 62 versions & 1 rubygems