Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/core/string.rb

Instance Method Summary collapse

Instance Method Details

#dc_expand(columns = 0...size) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/core/string.rb', line 3

def dc_expand columns = 0...size
  return [self] unless include? ArtDecomp::DontCare.to_s
  offsets = columns.sort
  i = index ArtDecomp::DontCare.to_s, offsets.shift until columns.include? i or offsets.empty?
  return [self] unless columns.include? i
  zero,    one    = dup, dup
  zero[i], one[i] = '0', '1'
  [zero.dc_expand(columns), one.dc_expand(columns)].flatten
end