lib/polyfill/v2_4/io/instance/readline.rb in polyfill-0.3.0 vs lib/polyfill/v2_4/io/instance/readline.rb in polyfill-0.4.0
- old
+ new
@@ -1,5 +1,7 @@
+require 'English'
+
module Polyfill
module V2_4
module IO
module Instance
module Readline
@@ -8,29 +10,26 @@
hash, others = args.partition { |arg| arg.is_a?(::Hash) }
input = super(*others)
if hash[0] && hash[0][:chomp]
- separator = others.find { |other| other.respond_to?(:to_str) }
- if separator
- input.chomp!(separator)
- else
- input.chomp!
- end
+ separator = others.find do |other|
+ other.respond_to?(:to_str)
+ end || $INPUT_RECORD_SEPARATOR
+
+ input.chomp!(separator)
end
input
end
end
- if RUBY_VERSION < '2.4.0'
- refine ::IO do
- include Method
- end
+ refine ::IO do
+ include Method
+ end
- def self.included(base)
- base.include Method
- end
+ def self.included(base)
+ base.include Method
end
end
end
end
end