Method: Backup::Config::DSL#preconfigure
- Defined in:
- lib/backup/config/dsl.rb
#preconfigure(name, &block) ⇒ Object
Allows users to create preconfigured models.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/backup/config/dsl.rb', line 86 def preconfigure(name, &block) unless name.is_a?(String) && name =~ /^[A-Z]/ raise Error, "Preconfigured model names must be given as a string " + "and start with a capital letter." end if DSL.const_defined?(name) raise Error, "'#{ name }' is already in use " + "and can not be used for a preconfigured model." end DSL.const_set(name, Class.new(Model)) DSL.const_get(name).preconfigure(&block) end |