Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/write_xlsx/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
- #ascii_only? ⇒ Boolean
-
#bytesize ⇒ Object
:nodoc:.
-
#each_char ⇒ Object
:nodoc:.
-
#first_line ⇒ Object
:nodoc:.
- #ord ⇒ Object
Instance Method Details
#ascii_only? ⇒ Boolean
40 41 42 |
# File 'lib/write_xlsx/compatibility.rb', line 40 def ascii_only? !!(self =~ /[^!"#\$%&'\(\)\*\+,\-\.\/\:\;<=>\?@0-9A-Za-z_\[\\\]\{\}^` ~\0\n]/) end |
#bytesize ⇒ Object
:nodoc:
28 29 30 |
# File 'lib/write_xlsx/compatibility.rb', line 28 def bytesize # :nodoc: self.length end |
#each_char ⇒ Object
:nodoc:
17 18 19 20 21 22 23 24 |
# File 'lib/write_xlsx/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_line ⇒ Object
:nodoc:
10 11 12 |
# File 'lib/write_xlsx/compatibility.rb', line 10 def first_line self.each_line { |line| return line } end |
#ord ⇒ Object
34 35 36 |
# File 'lib/write_xlsx/compatibility.rb', line 34 def ord self[0] end |