Sha256: cd2d93955665b60de4fdf9690d5d9e2b267ad4e936932f9a665728909dc7b607
Contents?: true
Size: 614 Bytes
Versions: 20
Compression:
Stored size: 614 Bytes
Contents
# frozen_string_literal: true Time.class_eval do class << self # Parses the `str` and returns `nil` if invalid def safe_parse(str) parse(str) rescue nil end end end if defined?(ActiveSupport::TimeZone) ActiveSupport::TimeZone.class_eval do class << self # Parses the `str` and returns `nil` if invalid def safe_parse(str) parse(str) rescue nil end end end end Date.class_eval do class << self # Parses the `str` and returns `nil` if invalid def safe_parse(str) parse(str) rescue nil end end end
Version data entries
20 entries across 20 versions & 1 rubygems