Module: Metasploit::Model::Spec::Template::Write
- 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
attributes
to disk if the created template is valid. -
#write!(attributes = {}) ⇒ void
Writes templates for
attributes
to 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.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/metasploit/model/spec/template/write.rb', line 19 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.
36 37 38 39 40 41 |
# File 'lib/metasploit/model/spec/template/write.rb', line 36 def write!(attributes={}) template = new(attributes) template.valid! template.write end |