lib/mihari/rule.rb in mihari-7.0.4 vs lib/mihari/rule.rb in mihari-7.0.5
- old
+ new
@@ -82,10 +82,24 @@
def data_types
data[:data_types]
end
#
+ # @return [Date, nil]
+ #
+ def created_on
+ data[:created_on]
+ end
+
+ #
+ # @return [Date, nil]
+ #
+ def updated_on
+ data[:updated_on]
+ end
+
+ #
# @return [Array<Mihari::Models::Tag>]
#
def tags
data[:tags].uniq.filter_map do |name|
Models::Tag.find_or_create_by(name: name)
@@ -277,11 +291,11 @@
#
def diff_comparable_data
# data is serialized as JSON so dates (created_on & updated_on) are stringified in there
# thus dates & (hash) keys have to be stringified when comparing
data.deep_dup.tap do |data|
- data[:created_on] = data[:created_on].to_s
- data[:updated_on] = data[:updated_on].to_s
+ data[:created_on] = created_on.to_s unless created_on.nil?
+ data[:updated_on] = updated_on.to_s unless updated_on.nil?
end.deep_stringify_keys
end
#
# Check whether a value is a falsepositive value or not