lib/whois/parsers/base.rb in whois-parser-1.2.0 vs lib/whois/parsers/base.rb in whois-parser-2.0.0
- old
+ new
@@ -1,11 +1,11 @@
#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
-# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
+# Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
#++
require 'time'
require_relative '../parser/contact'
@@ -43,11 +43,11 @@
# property_register(:disclaimer, Parser::PROPERTY_STATE_SUPPORTED) {}
# property_state(:disclaimer)
# # => :supported
#
def self.property_state(property)
- self._properties[property]
+ _properties[property]
end
# Check if the +property+ passed as symbol
# is registered in the registry for current parser.
#
@@ -64,13 +64,13 @@
# property_state?(:disclaimer)
# # => true
#
def self.property_state?(property, status = :any)
if status == :any
- self._properties.key?(property)
+ _properties.key?(property)
else
- self._properties[property] == status
+ _properties[property] == status
end
end
# Registers a <tt>property</tt> in the registry.
#
@@ -78,11 +78,11 @@
# @param [Symbol] status
#
# @return [void]
#
def self.property_register(property, status)
- self._properties = self._properties.merge({ property => status })
+ self._properties = _properties.merge({ property => status })
end
# Registers a <tt>property</tt> as "not implemented"
# and defines the corresponding private _property_PROPERTY method.
@@ -169,9 +169,10 @@
# @return [Nil] if the timestamp can't be parsed
# @return [Time]
#
def self.parse_time(timestamp)
return unless timestamp.is_a?(String) && !timestamp.empty?
+
Time.parse(timestamp).change(usec: 0)
rescue ArgumentError
nil
end