method
_expand_ch
v1_8_7_330 -
Show latest stable
- Class:
String
_expand_ch(str)private
No documentation available.
# File lib/jcode.rb, line 99
def _expand_ch str
a = []
str.scan(/(?:\\(.)|([^\\]))-(?:\\(.)|([^\\]))|(?:\\(.)|(.))/m) do
from = $1 || $2
to = $3 || $4
one = $5 || $6
if one
a.push one
elsif from.length != to.length
next
elsif from.length == 1
from[0].upto(to[0]) { |c| a.push c.chr }
else
from.upto(to) { |c| a.push c }
end
end
a
end