Sha256: 5b953e78a424cd228fb71ba85f56a20ec0fd35a4cc5ed5486ad31eaff5963289
Contents?: true
Size: 1 KB
Versions: 60
Compression:
Stored size: 1 KB
Contents
# Extend to add a class method to create a new template and write it only if valid. # # @example extend and write # class MyTemplate # extend Metasploit::Model::Spec::Template::Write # # def write # ... # end # end # # success = MyTemplate.write(attributes) module Metasploit::Model::Spec::Template::Write # Writes template for `attributes` to disk if the created template is valid. # # @return [true] if template was valid and was written. # @return [false] if template was invalid and was not written. # @see #write! def write(attributes={}) template = new(attributes) written = template.valid? if written template.write end written end # Writes templates for `attributes` to disk if created template is valid; otherwise, raises an exception. # # @return [void] # @raise [Metasploit::Model::Invalid] if template is invalid # @see write def write!(attributes={}) template = new(attributes) template.valid! template.write end end
Version data entries
60 entries across 60 versions & 1 rubygems