Module: Metasploit::Model::Spec::Template::Write
- Included in:
- Module::Ancestor::Spec::Template, Module::Class::Spec::Template, Module::Instance::Spec::Template
- Defined in:
- lib/metasploit/model/spec/template/write.rb
Overview
Extend to add a class method to create a new template and write it only if valid.
Instance Method Summary collapse
-
#write(attributes = {}) ⇒ true, false
Writes template for
attributesto disk if the created template is valid. -
#write!(attributes = {}) ⇒ void
Writes templates for
attributesto disk if created template is valid; otherwise, raises an exception.
Instance Method Details
#write(attributes = {}) ⇒ true, false
Writes template for attributes to disk if the created template is valid.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/metasploit/model/spec/template/write.rb', line 21 def write(attributes={}) template = new(attributes) written = template.valid? if written template.write end written end |
#write!(attributes = {}) ⇒ void
This method returns an undefined value.
Writes templates for attributes to disk if created template is valid; otherwise, raises an exception.
38 39 40 41 42 43 |
# File 'lib/metasploit/model/spec/template/write.rb', line 38 def write!(attributes={}) template = new(attributes) template.valid! template.write end |