Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn/compatibility.rb

Overview

Why would we ever use Ruby 1.8.7 when we can backport with something as simple as this?

Direct Known Subclasses

Prawn::Core::ByteString, Prawn::Core::LiteralString

Instance Method Summary (collapse)

Instance Method Details

- (Object) each_char

:nodoc:



14
15
16
17
18
19
20
21
# File 'lib/prawn/compatibility.rb', line 14

def each_char #:nodoc:
  # copied from jcode
  if block_given?
    scan(/./m) { |x| yield x }
  else
    scan(/./m)
  end
end

- (Object) first_line

:nodoc:



7
8
9
# File 'lib/prawn/compatibility.rb', line 7

def first_line
  self.each_line { |line| return line }
end