class Metasploit::Model::Search::Operation::Date

Search operation with {Metasploit::Model::Search::Operation::Base#operator} with `#type` ':date'. Validates that value is `String` that can parsed with `Date.parse` or already a `Date`.

Public Instance Methods

value=(formatted_value) click to toggle source

Sets {Metasploit::Model::Search::Operation::Base#value} by type casting String to actual Date.

@param formatted_value [#to_s] @return [Date] if `formatted_value.to_s` is parseable with `Date.parse`. @return [#to_s] `formatted_value` if `formatted_value` is not parseable with `Date.parse`.

# File app/models/metasploit/model/search/operation/date.rb, line 19
def value=(formatted_value)
  begin
    @value = Date.parse(formatted_value.to_s)
  rescue ArgumentError
    @value = formatted_value
  end
end

Private Instance Methods

date_value() click to toggle source

Validates that {#value} is a `Date`.

@return [void]

# File app/models/metasploit/model/search/operation/date.rb, line 32
def date_value
  unless value.is_a? Date
    errors.add(:value, :unparseable_date)
  end
end