Skip to content

Commit

Permalink
Adhere to existing code conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcPer committed Aug 5, 2024
1 parent 74a9e0d commit 3f94fb4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/csv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ def open(filename_or_io, mode="r", **options)
options.delete_if {|k, _| /newline\z/.match?(k)}

if filename_or_io.is_a?(StringIO)
f = init_stringio!(filename_or_io.string, mode, **file_opts)
f = create_stringio(filename_or_io.string, mode, **file_opts)
else
begin
f = File.open(filename_or_io, mode, **file_opts)
Expand Down Expand Up @@ -1924,13 +1924,13 @@ def may_enable_bom_detection_automatically(filename_or_io,
end

if RUBY_VERSION < "2.7"
def init_stringio!(str, mode, opts)
opts.reject! { |k, _| k == :universal_newline || DEFAULT_OPTIONS.key?(k) }
def create_stringio(str, mode, opts)
opts.delete_if { |k, _| k == :universal_newline or DEFAULT_OPTIONS.key?(k) }
raise ArgumentError, "Unsupported options parsing StringIO: #{opts.keys}" unless opts.empty?
StringIO.new(str)
StringIO.new(str, mode)
end
else
def init_stringio!(str, mode, opts)
def create_stringio(str, mode, opts)
StringIO.new(str, mode, **opts)
end
end
Expand Down

0 comments on commit 3f94fb4

Please sign in to comment.