Sha256: 6749c20906404cebc7f0bcc337913f295235e6c02b0b7544b852740d8a5b1383
Contents?: true
Size: 524 Bytes
Versions: 4
Compression:
Stored size: 524 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])(\w)/) { $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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pagemodels-0.2.3 | lib/page_models/core.rb |
pagemodels-0.2.2 | lib/page_models/core.rb |
pagemodels-0.2.1 | lib/page_models/core.rb |
pagemodels-0.2.0 | lib/page_models/core.rb |