Sha256: d557a08e65429d0c5eb031242ecff8dcbff5321659243deaffec5aabffb5d20d
Contents?: true
Size: 822 Bytes
Versions: 14
Compression:
Stored size: 822 Bytes
Contents
# coding: utf-8 # # Why would we ever use Ruby 1.8.7 when we can backport with something # as simple as this? # class String #:nodoc: def first_line self.each_line { |line| return line } end unless "".respond_to?(:lines) alias_method :lines, :to_a end unless "".respond_to?(:each_char) def each_char #:nodoc: # copied from jcode if block_given? scan(/./m) { |x| yield x } else scan(/./m) end end end end unless File.respond_to?(:binread) def File.binread(file) #:nodoc: File.open(file,"rb") { |f| f.read } end end if RUBY_VERSION < "1.9" def ruby_18 #:nodoc: yield end def ruby_19 #:nodoc: false end else def ruby_18 #:nodoc: false end def ruby_19 #:nodoc: yield end end
Version data entries
14 entries across 14 versions & 5 rubygems