Class: String

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

Overview

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

copied from prawn. modified by Hideo NAKAMURA

Instance Method Summary collapse

Instance Method Details

#bytesizeObject

:nodoc:


28
29
30
# File 'lib/writeexcel/compatibility.rb', line 28

def bytesize # :nodoc:
  self.length
end

#each_charObject

:nodoc:


17
18
19
20
21
22
23
24
# File 'lib/writeexcel/compatibility.rb', line 17

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

#first_lineObject

:nodoc:


10
11
12
# File 'lib/writeexcel/compatibility.rb', line 10

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

#ordObject


34
35
36
# File 'lib/writeexcel/compatibility.rb', line 34

def ord
  self[0]
end