Class: Metasploit::Model::Search::Operation::Date
- Defined in:
- app/models/metasploit/model/search/operation/date.rb
Overview
Search operation with Base#operator with #type
':date'. Validates that
value is String
that can parsed with Date.parse
or already a Date
.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#date_value ⇒ void
private
Validates that Base#value is a
Date
. -
#value=(formatted_value) ⇒ Date, #to_s
Sets Base#value by type casting String to actual Date.
Methods inherited from Base
Methods inherited from Base
Constructor Details
This class inherits a constructor from Metasploit::Model::Base
Instance Method Details
#date_value ⇒ void (private)
This method returns an undefined value.
Validates that Base#value is a Date
.
34 35 36 37 38 |
# File 'app/models/metasploit/model/search/operation/date.rb', line 34 def date_value unless value.is_a? Date errors.add(:value, :unparseable_date) end end |
#value=(formatted_value) ⇒ Date, #to_s
Sets Base#value by type casting String to actual Date.
21 22 23 24 25 26 27 |
# File 'app/models/metasploit/model/search/operation/date.rb', line 21 def value=(formatted_value) begin @value = Date.parse(formatted_value.to_s) rescue ArgumentError @value = formatted_value end end |