Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/edi/mapper.rb

Instance Method Summary collapse

Instance Method Details

#chunk(len) ⇒ Object



13
14
15
16
# File 'lib/edi/mapper.rb', line 13

def chunk(len)
  re = Regexp.new(".{0,#{len.to_i}}")
  self.scan(re).flatten.reject { |chunk| chunk.nil? or chunk.empty? }
end