Skip to content

Commit

Permalink
rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
ermolaev committed Feb 3, 2021
1 parent 51fafe5 commit c778e7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ end

group :benchmarks do
platform :mri do
gem "activemodel"
gem "attrio"
gem "benchmark-ips"
gem "fast_attributes"
gem "hotch"
gem "virtus"
gem "activemodel"
end
end
5 changes: 2 additions & 3 deletions lib/dry/types/coercions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def empty_str?(value)
EMPTY_STRING.eql?(value)
end

ISO_DATE = /\A(\d{4})-(\d\d)-(\d\d)\z/
ISO_DATE = /\A(\d{4})-(\d\d)-(\d\d)\z/.freeze
def fast_string_to_date(string)
if string =~ ISO_DATE
::Date.new $1.to_i, $2.to_i, $3.to_i
Expand All @@ -116,7 +116,7 @@ def fast_string_to_date(string)
(\d\d):(\d\d):(\d\d)(?:\.(\d{1,6})\d*)? # 10:20:30.123456
(?:(Z(?=\z)|[+-]\d\d)(?::?(\d\d))?)? # +09:00
\z
/x
/x.freeze
def fast_string_to_time(string)
return unless ISO_DATETIME =~ string

Expand All @@ -132,7 +132,6 @@ def fast_string_to_time(string)

::Time.local($1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, usec, offset)
end

end
end
end

0 comments on commit c778e7d

Please sign in to comment.