Module: Metasploit::Model::Derivation
- Extended by:
- ActiveSupport::Autoload, ActiveSupport::Concern
- Defined in:
- lib/metasploit/model/derivation.rb,
lib/metasploit/model/derivation/full_name.rb
Overview
Allow to declare that attributes should be derived, which will set the attribute equal to derived_nil
before validation. Optionally, it can be checked if the attribute matches the
derived_
Defined Under Namespace
Modules: ClassMethods, FullName
Instance Method Summary collapse
-
#derive ⇒ void
private
Derives each attribute in ClassMethods#validate_by_derived_attribute if the attribute is
nil
.
Instance Method Details
#derive ⇒ void (private)
This method returns an undefined value.
Derives each attribute in Metasploit::Model::Derivation::ClassMethods#validate_by_derived_attribute if the attribute is nil
.
100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/metasploit/model/derivation.rb', line 100 def derive self.class.validate_by_derived_attribute.each_key do |attribute| value = send(attribute) # explicitly check for `nil` in case attribute is Boolean if value.nil? derived_value = send("derived_#{attribute}") send("#{attribute}=", derived_value) end end end |