Sha256: 63c0587dcd603bad358e5730c59cc1faf3864c81625a4f84a3c53d5658e811b5
Contents?: true
Size: 527 Bytes
Versions: 6
Compression:
Stored size: 527 Bytes
Contents
module PageModels def self.configure config = PageModels::Configuration.instance yield(config) config.integrate! end def self.create(page, args) args = args.scan(/"([^"]+)"/).map(&:first) page_model_class_name = page.gsub(/(?:^|[^\w])([a-z])/) { $1.upcase } Kernel.const_get(page_model_class_name).new(*args) rescue NameError => e if e.instance_of?(NameError) # Could be a NoMethodError raise MissingPageModelError.new(page_model_class_name) else raise e end end end
Version data entries
6 entries across 6 versions & 1 rubygems