Module: Polyfill::V2_4::IO::Class::Readlines::Method
- Defined in:
- lib/polyfill/v2_4/io/class/readlines.rb
Instance Method Summary collapse
Instance Method Details
#readlines(file_name, *args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/polyfill/v2_4/io/class/readlines.rb', line 7 def readlines(file_name, *args) hash, others = args.partition { |arg| arg.is_a?(::Hash) } inputs = super(file_name, *others) if hash[0] && hash[0][:chomp] separator = others.find { |other| other.respond_to?(:to_str) } if separator inputs.each { |input| input.chomp!(separator) } else inputs.each(&:chomp!) end end inputs end |