Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/psych/scalar_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def parse_int string
def parse_time string
klass = class_loader.load 'Time'

date, time = *(string.split(/[ tT]/, 2))
date, time = *(string.split(/[Tt]|\s+/, 2))
(yy, m, dd) = date.match(/^(-?\d{4})-(\d{1,2})-(\d{1,2})/).captures.map { |x| x.to_i }
md = time.match(/(\d+:\d+:\d+)(?:\.(\d*))?\s*(Z|[-+]\d+(:\d\d)?)?/)

Expand Down
5 changes: 5 additions & 0 deletions test/psych/test_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ def test_single_quote_when_matching_date
RUBY
end

def test_datetime_string_with_tab_separator
str = "2023-12-31\t12:00:00"
assert_cycle str
end

def test_plain_when_shorten_than_line_width_and_no_final_line_break
str = "Lorem ipsum"
yaml = Psych.dump str, line_width: 12
Expand Down
Loading