Sha256: c0974d98e451a254e05740be99df0fa921d4defe2dfe78710a5fb3383c41cc4b
Contents?: true
Size: 796 Bytes
Versions: 1
Compression:
Stored size: 796 Bytes
Contents
module CanTango::Permit module Helper module License def licenses *names names.to_strings.each do |name| try_license name end end def license name raise ArgumentError, "Argument must be a single label" if !name.kind_of_label? licenses name end protected def license_const name license_class(name).constantize rescue NameError raise "License #{license_class(name)} is not defined" end def license_class name "#{name.camelize}License" end def try_license name license_const(name).new(self).calc_rules rescue Exception => e raise "License #{license_const(name)} could not be executed: #{e}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cantango-permits-0.1.1 | lib/cantango/permit/helper/license.rb |